Fast non-cryptographic hash functions powered by Zig via WebAssembly
npm install @zig-wasm/hashFast non-cryptographic hash functions powered by Zig via WebAssembly.
- pnpm add @zig-wasm/hash
``ts
import { crc32Hex, wyhash, xxhash64 } from "@zig-wasm/hash";
const crc = await crc32Hex("payload");
const xxh = await xxhash64(new Uint8Array([1, 2, 3]));
const wy = await wyhash("payload"); // Uint8Array digest
`
Call await init() before using any *Sync helpers (crc32Sync, hashSync,
etc.).
- Checksums: crc32, adler32xxhash32/64
- General-purpose: , wyhash, fnv1a32/64, murmur2_64,cityhash64
hash
- Generic helpers: , hashHex, hash32, hash64 with HashAlgorithm
types
See src/index.ts for the full async and sync exports.
- Async APIs lazy-load hash.wasm.init({ wasmUrl | wasmPath | wasmBytes, imports })
- Override with when
self-hosting.
- Build: pnpm --filter @zig-wasm/hash buildpnpm --filter @zig-wasm/hash test
- Test: pnpm --filter @zig-wasm/hash lint
- Lint/format: /pnpm --filter @zig-wasm/hash fmt
pnpm --filter @zig-wasm/hash typecheck`
- Typecheck: