·
470 commits
to main
since this release
First release 🚀
xxhash-rust
binding for Node.js.
Performance
@node-rs/xxhash 64 x 43,532 ops/sec ±1.33% (88 runs sampled)
xxhash C++ x 41,658 ops/sec ±1.45% (90 runs sampled)
wasm x 32,415 ops/sec ±1.38% (90 runs sampled)
xxhashjs h64 x 47.52 ops/sec ±3.20% (62 runs sampled)
xxh64 bench suite: Fastest is @node-rs/xxhash 64
Support matrix
node12 | node14 | node16 | |
---|---|---|---|
Windows x64 | ✓ | ✓ | ✓ |
Windows x32 | ✓ | ✓ | ✓ |
Windows arm64 | ✓ | ✓ | ✓ |
macOS x64 | ✓ | ✓ | ✓ |
macOS arm64 (m chips) | ✓ | ✓ | ✓ |
Linux x64 gnu | ✓ | ✓ | ✓ |
Linux x64 musl | ✓ | ✓ | ✓ |
Linux arm gnu | ✓ | ✓ | ✓ |
Linux arm64 gnu | ✓ | ✓ | ✓ |
Linux arm64 musl | ✓ | ✓ | ✓ |
Android arm64 | ✓ | ✓ | ✓ |
FreeBSD x64 | ✓ | ✓ | ✓ |
API
export type BufferLike =
| Buffer
| string
| Uint8Array
| ArrayBuffer
| SharedArrayBuffer
| ReadonlyArray<number>
| number[]
export function xxh32(input: BufferLike, seed?: number): number
export function xxh64(input: BufferLike, seed?: BigInt): BigInt
export class Xxh32 {
constructor(seed?: number)
update(input: BufferLike): this
digest(): number
reset(): void
}
export class Xxh64 {
constructor(seed?: BigInt)
update(input: BufferLike): this
digest(): BigInt
reset(): void
}
export class Xxh3 {
static withSeed(seed?: BigInt): Xxh3
static withSecret(secret: BufferLike): Xxh3
private constructor() {}
update(input: BufferLike): this
digest(): BigInt
reset(): void
}
export const xxh3: {
xxh64: (input: BufferLike, seed?: BigInt) => BigInt
xxh64WithSecret: (input: BufferLike, secret: BufferLike) => BigInt
xxh128: (input: BufferLike, seed?: BigInt) => BigInt
xxh128WithSecret: (input: BufferLike, secret: BufferLike) => BigInt
Xxh3: typeof Xxh3
}