hash-wasm
Lightning-fast hash and password-derivation functions using hand-tuned WebAssembly binaries
Repository Health
Technical Analysis
hash-wasm is a JavaScript/TypeScript library that computes a wide range of cryptographic and non-cryptographic hash functions — MD4/MD5, the SHA-1/2/3 families, Keccak, BLAKE2/BLAKE3, RIPEMD-160, xxHash, SM3, Whirlpool, Adler-32, and CRC32/CRC64 — plus password-hashing and key-derivation functions like Argon2, bcrypt, scrypt, and PBKDF2. Each algorithm is implemented as a hand-tuned WebAssembly binary rather than pure JavaScript, giving it significantly higher throughput than most JS-only hash libraries in both browsers and Node.js.
It exposes both simple one-shot functions and streaming/incremental hashing APIs, keeping bundle size per algorithm small since each hash ships as its own WASM module loaded on demand.
What You Get
- One-shot hash functions (
md5(),sha256(),blake3(), etc.) returning hex-encoded digests - Password/KDF functions: Argon2d/i/id, bcrypt, scrypt, and PBKDF2 with configurable cost parameters
- Streaming/incremental hashing via a
createXXX()instance for large or chunked input - HMAC support layered over any of the included hash algorithms
- Per-algorithm WASM modules kept small (a few KB gzipped each) to minimize bundle impact
Common Use Cases
- Client-side file integrity checks (computing a checksum before or after upload)
- Password hashing with Argon2/bcrypt/scrypt in a Node.js authentication service
- High-throughput data fingerprinting (dedup, caching keys) using fast non-cryptographic hashes like xxHash
- Cross-platform code needing identical hash implementations in both the browser and Node.js
Under The Hood
Architecture hash-wasm’s lib/ directory contains one TypeScript wrapper per algorithm (md5.ts, sha256.ts, blake3.ts, argon2.ts, bcrypt.ts, scrypt.ts, etc.), each of which loads and drives a dedicated, hand-written WebAssembly binary (compiled from C, per the repo’s C/TypeScript language split) through a shared lockedCreate/mutex loading mechanism (lib/lockedCreate.ts, lib/mutex.ts) that manages async WASM instantiation and prevents concurrent-load races. A common index.ts re-exports every algorithm as a flat, tree-shakeable API.
Tech Stack Roughly 60% TypeScript / 40% hand-written C compiled to WebAssembly, published with UMD and ESM builds (dist/index.umd.js, dist/index.esm.js) and full .d.ts type declarations. Build tooling uses a custom scripts/build.sh to compile the C sources to WASM and bundle the TypeScript wrappers; linting runs via Biome.
Code Quality Tests run under Jest with --expose-gc --logHeapUsage and coverage tracked via Codecov, indicating attention to memory behavior given the WASM-heap interaction. However, the repository shows very low recent commit activity (health-score development_activity of 0) and only 3 contributors, with the last tagged release in late 2024 — a maintenance risk despite the code’s technical soundness.
API Design The API is deliberately minimal and consistent across all ~25 supported algorithms — call the matching async function or createXxx() instance — which makes it easy to swap algorithms without relearning the interface, and the per-algorithm module design keeps bundle size proportional only to the hashes actually used.
Used by 6 apps in this directory
ALTCHA
Security
A self-hosted, privacy-first CAPTCHA alternative that uses memory-hard proof-of-work to stop bots without cookies, tracking, or third-party APIs.
Enso
Analytics · Data Engineering · Low Code Platforms
A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.
Logto
Authentication
Open-source auth infrastructure for SaaS and AI apps with OIDC, SAML, and RBAC
Notesnook
Note Taking · File Storage · Security
End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.
Polar
Ecommerce · Developer Tools · Invoicing Finance
Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.
Super Productivity
Productivity · Project Management
A privacy-respecting, local-first task manager with built-in timeboxing, Pomodoro timer, and deep integrations for Jira, GitHub, GitLab, and CalDAV — no accounts, no data collection, ever.