hashing function and example implementation