MurmurHash3 is a fast, high-quality non-cryptographic hash function designed by Austin Appleby, used throughout databases, caches, and probabilistic data structures. This calculator implements the 32-bit x86 variant (MurmurHash3_x86_32) with a configurable seed, computing everything locally in the browser.
How MurmurHash3 works
The algorithm processes the input in 4-byte little-endian blocks, applies a finalisation avalanche, then produces a 32-bit result:
Initialise:
h1 = seed
c1 = 0xcc9e2d51
c2 = 0x1b873593
Body (each 4-byte block k):
k = k * c1 (mod 2^32)
k = rotl32(k, 15)
k = k * c2 (mod 2^32)
h1 = h1 XOR k
h1 = rotl32(h1, 13)
h1 = h1 * 5 + 0xe6546b64
Tail (1–3 remaining bytes): Mix remaining bytes through the same c1/rotate/c2 pipeline and XOR into h1.
Finalise:
h1 = h1 XOR length
h1 = fmix32(h1) // avalanche: shifts, XORs, and multiplications
The constants 0xcc9e2d51 and 0x1b873593 were selected empirically to maximise avalanche efficiency, and fmix32 ensures every output bit depends on every input bit even for very short inputs.
Reference values
| Input | Seed | Hex | Decimal |
|---|---|---|---|
| (empty) | 0 | 0x00000000 | 0 |
hello | 0 | 0x248bfa47 | 613153351 |
hello | 42 | 0xcedc2d7c | 3470532988 |
MurmurHash3 | 0 | 0x9bfa9004 | 2616860676 |
The empty string always returns 0 with seed 0 because the body loop never runs and the finalisation of length 0 avalanches 0.
The role of the seed
The seed initialises h1, so the same input produces a completely different hash for each seed value. This property makes MurmurHash3 useful for:
- Bloom filters — use multiple independent seeds to produce independent hash functions for the same key.
- Sharding — assign different seeds to replicas so the same key maps to different buckets in each.
- Randomised hash tables — choose a random seed at startup to defeat hash-flooding attacks (though SipHash is more suitable if adversarial input is a real concern).
Why MurmurHash3 — and where it is actually used
MurmurHash3 was designed specifically to outperform FNV and djb2 in avalanche quality and speed while remaining simple to implement. Real-world users include:
- Apache Cassandra — uses MurmurHash3 as its default partitioner for distributing rows across the ring.
- Redis — cluster slot assignment uses a CRC-16, but several Redis modules and client libraries use Murmur for consistent hashing.
- Elasticsearch / Lucene — uses MurmurHash3 in bloom filter implementations.
- Protocol Buffers — some proto-related tooling uses Murmur for fingerprinting.
- Python — the
mmh3package provides MurmurHash3 bindings and is widely used in data science pipelines.
Comparison with similar hashes
| Hash | Output | Notes |
|---|---|---|
| djb2 | 32 bits | Simpler, slightly lower quality distribution |
| FNV-1a | 32 or 64 bits | One byte at a time; no bulk lane processing |
| MurmurHash3 | 32 or 128 bits | 4-byte blocks; better avalanche than djb2/FNV |
| xxHash32/64 | 32 or 64 bits | Generally faster than Murmur; also has 128-bit variant |
For new code, xxHash is often faster while matching or exceeding MurmurHash3’s distribution quality. Choose MurmurHash3 when you need to match the output of an existing system (Cassandra, LevelDB, etc.) that already uses it.