Isomorphic wrapper for xxhash-wasm and xxhashjs
npm install isomorphic-xxhash,
plain xxhash-wasm offers a slightly smaller UMD build as well as an ES module.Usage
$3
`ts
import XXH from "isomorphic-xxhash";
// const XXH = require("isomorphic-xxhash");const xxhash = await XXH();
xxhash.h32(/ may provide a seed (number) /)
.update("text")
.update(new Uint8Array([ 32, 58, 68 ]))
.digest(); // number (781456070)
xxhash.h64(/ may provide a seed (bigint) /)
.update("more text")
.update(new Uint8Array([ 32, 240, 159, 152, 179 ]))
.digest(); // bigint (5612704373666880606n)
`$3
`html
`
The global XXH` will be available.