---
title: "xxHash"
description: "XXH64 or XXH32 with an optional seed. For hash tables and bloom filters and dedup and nothing secret"
canonical_url: "https://hashes.agntn.dev/algorithms/xxhash"
---
# xxHash

> XXH64 or XXH32 with an optional seed. For hash tables and bloom filters and dedup and nothing secret

<algorithm-facts name="xxhash">



</algorithm-facts>

xxHash, built for speed and good distribution in hash tables, bloom filters and dedup. Anyone can find collisions on purpose. XXH64 by default, XXH32 with `bits: 32`, the one lz4 frames check their blocks with. zstd keeps the low four bytes of XXH64 for its own check.

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

The seed is an unsigned integer as wide as `bits`. 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 C library on hundreds of inputs, after an earlier version of this package got XXH64 quietly wrong. That's the regression test's reason to exist.


## Sitemap

See the full [sitemap](https://hashes.agntn.dev/sitemap.md) for all pages.
