i have an two arrays : char data1[length] where length is a multiple of 8 i.e length can be 8, 16,24 … The array contains binary data read from a file that is open in binary mode. I will keep reading from the file and everytime i read i will store the read value in a hash table. The disterbution of this binary data has a random distribution. I would like to hash each array and store them in a hash table in order to be able to look for the char with the specific data again. What would be a good hashing function to achive this task. Thanks
Please note that i am writing this in c++ and c so any language you choose to provide a solution for would be great.
If the data that you read is 8 bytes long and really distributed randomly, and your hashcode needs to be 32 bits, what about this:
If you need more speed, this code can probably made a lot faster if you can guarantee that
datais always properly aligned to be interpreted as anconst uint32_t *.