Algorithms

xxHash (XXH64)

XXH64 with an optional 64-bit seed. For hash tables and bloom filters and dedup and nothing secret
IDxxhash21 / 24non-cryptographic · 64-bit
Hash / Non-cryptographic

xxHash (XXH64)

XXH64, for hash tables and nothing secret.

Digest
64-bit · 8 bytes
HMAC
no key mode
Security
NOT for security: fast hash for hash tables
Family
4 in non-cryptographic
2 options, 0 required

Sample

hex
45ab6734b21e6968
base64
RatnNLIeaWg=

Options

encodingstring
default hex
Output encoding: hex, base64, base64url, binary
seednumber
default 0
Seed value for xxHash

Access

Createcreate("xxhash")
CLIhashes xxhash 'hello world'
Tryplayground with the sample above
Kincrc32, crc16-xmodem, fnv1a

XXH64, the 64-bit xxHash. Built for speed and good distribution in hash tables, bloom filters and dedup. Anyone can find collisions on purpose.

ts
create("xxhash").hash("").digest; // "ef46db3751d8e999"
create("xxhash").hash("abc").digest; // "44bc2cf5ad770999"
create("xxhash").hash("abc", { seed: 1 }).digest; // "bea9ca8199328908"

The seed is an unsigned 64-bit integer. Past Number.MAX_SAFE_INTEGER, pass it as a bigint or a decimal string, so "18446744073709551615" works and nothing gets rounded. Checked against the reference xxhash on hundreds of inputs, after an earlier version of this package got it quietly wrong. That's the regression test's reason to exist.