Reputation: 3
I'm currently implementing a HashTable in C++ using universal hashing (matrix hashing). The way I implement the matrix is by making an array of pointers (which are merely random bits, they do not "work" as pointers but as a 32x64 bit matrix). In order to hash the key, I multiply the pointer key to the matrix (using bit operations), which makes a 32 bits column (our hashed key). This raises a big question:
Is it possible to use a class (more properly, a C++ string) to fill with random bits and do bit operations? I do not care if the data in the string is pure garbage, I just use it to hash. Or, as an alternative, how can I make a 32-byte type and cast a string into one?
Upvotes: 0
Views: 82