Fast String Hashing Algorithm with low collision rates with 32 bit integer

Jason Citron picture Jason Citron · Sep 22, 2008 · Viewed 87k times · Source

I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is unknown (and changes over time). What is a fast string hashing algorithm that will generate small (32 or 16) bit values and have a low collision rate?

I'd like to see an optimized implementation specific to C/C++.

Answer

yrp picture yrp · Sep 22, 2008

Murmur Hash is pretty nice.