Update March 3, 2008 - Alignment- and endian-neutral version added by popular request.
Extremely simple - compiles down to ~52 instructions on x86.
Excellent distribution - Passes chi-squared tests for practically all keysets & bucket sizes.
Excellent avalanche behavior - Maximum bias is under 0.5%.
Excellent collision resistance - Passes Bob Jenkin's frog.c torture-test. No collisions possible for 4-byte keys, no small (1- to 7-bit) differentials.
Excellent performance - measured on an Intel Core 2 Duo @ 2.4 ghz
FNV - 443.668038 mb/sec
SuperFastHash - 985.335173 mb/sec
lookup3 - 988.080652 mb/sec
MurmurHash 1.0 - 1363.293480 mb/sec
MurmurHash 2.0 - 2056.885653 mb/sec
Source code (All code is released to the public domain)
for the simple implementation - MurmurHash2.cpp
for the aligned-read-only implementation - MurmurHashAligned2.cpp
for the (slower) endian-neutral implementation - MurmurHashNeutral2.cpp
If you want MurmurHash 1.0, the source is still available - simple and aligned
All detailed testing results have been moved to the Statistics page.
The name, if you're wondering, comes from the simplest sequence of operations which will thoroughly mix the bits of a value - "x *= m; x = rotate_left(x,r);" - multiply and rotate. Repeat that about 15 times using 'good' values of m and r, and x will end up pseudo-randomized. Unfortunately multiply+rotate has a few major weaknesses when used in a hash function, so I used multiply+shift+xor. I liked the name Murmur better than Musxmusx, so I kept it.
I've added a random brain-dump discussion page, where I'll put more info about how I found the hash constants, test methodology, etc.