Hashing Algorithm for Hash Table Implementation

hash, hashmap, hashtable

Solution

You can see here xxhash

Your mentioned hash function is very fast, but it is very bad too. If you want a "stupid" hash function maybe you can consider the modulus.

Example:

int key = item % size_of_hash_table

Problem

I'm looking for a high-speed hashing function with good (i.e near uniform) distribution for use in a hash table implementation. The hash table will be used exclusively for storing values with an integer key. Can i just use the lower few bits of the integer as the hash? e.g int key = n & 15; and create an array with 16 slots to store them. Any recommendations?

Original source