MurmurHash3 for Node.js and browsers. Includes 32-bit and 128-bit variants.
Note: MurmurHash is non-cryptographic. Do not use for passwords, security tokens, or other sensitive data.
- 32-bit and 128-bit hash outputs
- x86 and x64 128-bit variants
- Streaming API for large data
- String and Uint8Array inputs
- TypeScript definitions included
- Zero dependencies
npm install murmur-hashimport { hash32, hash128, hash128x64 } from 'murmur-hash';
hash32('hello'); // 613153351
hash128('hello'); // '2360ae465e6336c6ad45b3f4ad45b3f4'
hash128x64('hello'); // 'cbd8a7b341bd9b025b1e906a48ae1d19'Returns a 32-bit unsigned integer.
hash32('hello') // 613153351
hash32('hello', 42) // with seed
hash32(new Uint8Array([1,2,3])) // binary inputReturns a 128-bit hash (x86 variant) as hex string or BigInt.
hash128('hello') // hex string
hash128('hello', { seed: 42 }) // with seed
hash128('hello', { output: 'bigint' }) // as BigIntReturns a 128-bit hash (x64 variant) as hex string or BigInt.
hash128x64('hello') // hex string
hash128x64('hello', { seed: 42 }) // with seed
hash128x64('hello', { output: 'bigint' }) // as BigIntimport { createHash32, createHash128, createHash128x64 } from 'murmur-hash';
const hasher = createHash32();
hasher.update('hello');
hasher.update(' world');
hasher.digest(); // same as hash32('hello world')type HashInput = string | Uint8Array;
interface Hash128Options {
seed?: number; // default: 0
output?: 'hex' | 'bigint'; // default: 'hex'
}Benchmarks on Apple M1 (ops/sec):
hash32 short string 2,000,000+
hash32 1KB bytes 560,000
hash128 short string 540,000
hash128 1KB bytes 350,000
hash128x64 short string 530,000
hash128x64 1KB bytes 35,000
Run locally: npm run bench
The v1 API still works but is deprecated:
// v1 (deprecated)
import { v3 } from 'murmur-hash';
v3.x86.hash32('hello');
// v2
import { hash32 } from 'murmur-hash';
hash32('hello');Node.js 20+ or modern browsers (ES2020).
MIT