Library:MurmurHash
Appearance
| On this wiki | Facts · Code · Notes · Topics |
|---|
Austin Appleby's MurmurHash2 and MurmurHash3 non-cryptographic hashes (public domain) and the SMHasher test suite (MIT) that holds their reference code: common as a 32 or 128-bit hash for names, hash tables and bloom filters.
Identification
- Reference code: https://github.com/aappleby/smhasher,
src/MurmurHash3.cpp(public domain; the suite is MIT). - MurmurHash3_x86_32 uses c1 0xCC9E2D51, c2 0x1B873593, rotates 15 and 13,
h*5 + 0xE6546B64per block and the fmix32 finaliser with 0x85EBCA6B and 0xC2B2AE35. x86_128 uses c1 0x239B961B, c2 0xAB0E9789 and others; x64_128 uses 0x87C37B91114253D5 and 0x4CF5AD432745937F with rotates 31 and 33 and fmix64. Constants as read in MurmurHash3.cpp (lines 71-73, 102-103, 120, 161-162, 264-265). - A binary with
0xCC9E2D51and0x1B873593as immediates is MurmurHash3 x86_32 (also copied into many other libraries asmurmur3_32);0x85EBCA6Band0xC2B2AE35alone is the fmix32 finaliser, also used standalone as an integer hash. - SMHasher's main.cpp lists verification codes for each hash (Murmur3A 0xB0F57EE3, Murmur3C 0xB3ECE62A, Murmur3F 0x6384BA69, Murmur2 0x27864C1E, FNV 0xE3CBBE91, lookup3 0x3D83917A, City64 0x25A20825), a single 32-bit value computed by hashing keys of lengths 0..255 with seed 256-i and hashing the results; matching it proves an implementation is bit-compatible.
Variants
MurmurHash3 has x86_32, x86_128 and x64_128; the 128-bit outputs differ between x86 and x64 versions. MurmurHash2, MurmurHash2A, MurmurHash64B, MurmurHashNeutral2 and MurmurHashAligned2 use multiplier 0x5bd1e995 and shift 24, but MurmurHash64A uses the 64-bit multiplier 0xc6a4a7935bd1e995 and shift 47 (src/MurmurHash2.cpp, smhasher commit 07bb4de10a63e8cc2e1724865454eba635742383: lines 42-43, 98-99, 144-145, 208-209, 341-342, 396-397).
Code & repositories
- https://github.com/aappleby/smhasher @
07bb4de10a63e8cc2e1724865454eba635742383· license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
MurmurHash reference code and the SMHasher hash test suite with verification codes (MIT, Murmur public domain).
Tested on: source read, not run: files read: src/MurmurHash3.cpp, src/Hashes.cpp, src/City.cpp, src/main.cpp · checked 2026-10-18; last activity 2026-06-25