Skip to main content
Home

A fast, simple xxHash64 (and XXH3) implementation in TypeScript/WASM.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
a year ago (2.0.0)

xxHash64

A fast, simple xxHash64 (and XXH3) implementation in TypeScript/WASM.

Example

import * as XXH64 from "https://deno.land/x/xxhash64/mod.ts"

let h = await XXH64.create()
h.update('abc')
h.digest() // #=> Uint8Array(8) [ 68, 188, ... ]
h.digest('bigint') // #=> 11027476751619767364n
h.digest('hex') // #=> "44bc2cf5ad770999"

// Continue updating/digesting a hash...
h.update('xyz').digest('hex') // #=> "19434a35e8bf0983"
h.update('xyz').digest('hex') // #=> "578474f682ca960f"

// Reset to generate a new hash:
h.reset().update('xyz').digest('hex') // #=> "feba48465b833ca1"

// Combine reset/update/digest in one call:
h.hash('xyz', 'hex') // #=> "feba48465b833ca1"

// Improved XXH3 64-bit algorithm...
let h3 = await XXH64.create3()
h3.hash('xyz', 'hex') // #=> "6276d2656f411f1f"
h3.hash('abc', 'bigint') // #=> 5780703864653066104n

// Reseeding...
const seed = new Uint8Array([1,0,0,0,0,0,0,0])
h3.reseed(seed).update('xyz').digest('hex') // #=> d819f2585dc69106

References

License

This project is licensed under the terms of the MIT license and others.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";
or

Import directly with a jsr specifier

import * as xxhash__ from "jsr:@jabr/xxhash64";

Add Package

pnpm i jsr:@jabr/xxhash64
or (using pnpm 10.8 or older)
pnpm dlx jsr add @jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";

Add Package

yarn add jsr:@jabr/xxhash64
or (using Yarn 4.8 or older)
yarn dlx jsr add @jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";

Add Package

vlt install jsr:@jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";

Add Package

npx jsr add @jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";

Add Package

bunx jsr add @jabr/xxhash64

Import symbol

import * as xxhash__ from "@jabr/xxhash64";