Small TypeScript helpers for deterministic MurmurHash3 x86_32 hashes of UTF-8 strings.
It is intended for browser-safe bucketing, cache keys, feature rollout buckets, fixture IDs, and non-cryptographic fingerprints. It has no runtime dependency and does not use Node-only APIs.
Try the browser preview: packages.wasta-wocket.fr/murmur-string-hash-kit.
- TypeScript types are generated from the source.
- ESM-only package with no runtime dependencies.
- Marked as side-effect free for bundlers.
- CI runs
npm ci,typecheck,build, andtest. - Tested on Node.js 20 and 22 with GitHub Actions.
- Browser-friendly implementation with no Node-only APIs.
import { hashString, hashStrings } from "murmur-string-hash-kit";
hashString("café", { seed: 42 });
// { value: 1990984759, hex: "76af9d77", base36: "wxux1z", seed: 42, bytes: 5 }
hashStrings(["alpha", "beta"], { seed: 7 });
// [{ input: "alpha", ... }, { input: "beta", ... }]Returns a structured hash result:
value: unsigned 32-bit integer.hex: zero-padded 8-character hexadecimal string.base36: compact lowercase base36 string.seed: normalized unsigned 32-bit seed.bytes: UTF-8 byte length used for hashing.
Options:
seed: integer seed, default0.maxBytes: optional cap for untrusted input. No cap is applied by default.
Returns only the unsigned 32-bit integer.
Returns only the zero-padded hexadecimal string.
Hashes many strings while preserving the original input beside each result.
This package implements only MurmurHash3 x86_32. It deliberately does not implement x64 or 128-bit variants, because the first draft targets the common browser-friendly string fingerprint case.
MurmurHash3 is not cryptographic. Do not use it for passwords, signatures, secrets, or adversarial integrity checks.
The implementation hashes UTF-8 bytes, not UTF-16 code units. It includes independent x86_32 vectors covering embedded nulls, endian-sensitive chunks, tail lengths, non-ASCII text, and long strings.