A minimal hash function for C? A minimal hash function for C? c c

A minimal hash function for C?


You can find a good (and fast) hash function, and an interesting read, at http://www.azillionmonkeys.com/qed/hash.html

The only time you should not check for collisions, is if you use a perfect hash -- a good old fashioned lookup table, like gperf.


  1. Here is a nice overview of the most notable known hash functions.

  2. 32bits should work just fine.

  3. You always need to check for collisions, unless you want to write a funny hashtable :)


A general hash function for hash table lookup. It specifies Do NOT use for cryptographic purposes, but since you specified that you have no intent for that then you should be ok.

It Included is A Survey of Hash Functions to try out