1mb

build with

murmur-hash

MurmurHash3 for JS, checked against mmh3

get murmur-hash docs

hash32, hash128 and hash128x64 are the x86 32-bit, x86 128-bit and x64 128-bit variants of MurmurHash3. A string is hashed as UTF-8, bytes as given. The 128-bit result is a hex string or a bigint.

hash32('hello') is 613153351, the number mmh3.hash('hello', signed=False) returns. A fixture of 468 cases generated with mmh3 covers every variant.

The 128-bit hex writes each word most significant byte first. mmh3.hash_bytes().hex() writes each word the other way round.

why it exists

A hash used to partition keys or index a Bloom filter has to come out the same in every service. murmur-hash was built to give JavaScript the MurmurHash3 that Python's mmh3 computes, in 128 bits as well as 32.

what it taught

A 128-bit hash can be written out in two byte orders. hash128('hello') gives 2b2444a0db91def79adb31b69adb31b6. Python's mmh3.hash_bytes('hello', x64arch=False).hex() gives a044242bf7de91dbb631db9ab631db9a. Read as four 8-character words, each word holds the same bytes in reverse order.

get murmur-hash

related

all work