Hashing Implementation in C++