Files
skills/plugins/document-navigator/docs/foundation/bitpacker/bitpacker-crypto/src/xxhash32.md
admin 9bf56a806b Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into
plugins/document-navigator/docs/ so the plugin is self-contained and
portable. docs/superpowers/ (specs and plans) stays at the repo root.

Moved via cp+rm rather than git mv because directory rename() fails with
EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the
identical-content files at commit time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 01:10:00 +01:00

1010 B

xxhash32

Path: src/xxhash32.ts
Export: calculateXxhash32, verifyXxhash32, packXxhash32, unpackXxhash32, appendXxhash32, verifyAndStripXxhash32

What it does

Pure TypeScript implementation of the XXHash32 non-cryptographic hash algorithm (spec v0.8.2). No external dependencies.

Key API

Function Description
calculateXxhash32(data, seed?) Compute 32-bit hash of a Uint8Array
verifyXxhash32(data, expected, seed?) Verify a hash matches
packXxhash32(checksum) Pack hash as 4 little-endian bytes
unpackXxhash32(bytes, offset?) Unpack 4 bytes to hash value
appendXxhash32(data, seed?) Append 4-byte hash to data
verifyAndStripXxhash32(data, seed?) Verify and strip appended hash

Constants

  • PRIME1 = 0x9e3779b1
  • PRIME2 = 0x85ebca77
  • PRIME3 = 0xc2b2ae3d
  • PRIME4 = 0x27d4eb2f
  • PRIME5 = 0x165667b1

Used by

  • Checksum validation in downstream network protocols