EB-BENCH v1.0 · OPEN EMPIRICAL LAB

WebCrypto vs. WebAssembly vs. Pure JS

Browser cryptography has no single winner across runtimes. Peak speed and security come from routing hardware primitives to native SubtleCrypto, tight 32-bit loops lacking native APIs to WASM, and standardized post-quantum lattice math cleanly to audited ESM JS/WASM.

1. Live 3-Way Runtime Pair Benchmark

Run identical algorithms across native SubtleCrypto, self-hosted hash-wasm, and Pure-ESM Noble inside your own browser tab (connect-src 'none').

Read full EB-Bench report →
Ready. Measures SHA-256 (WebCrypto vs WASM), BLAKE3 (WASM vs JS), Argon2id (WASM vs JS).
Primitive Runtime Metric Median CV
SHA-256 WebCrypto vs WASM Click run — —
BLAKE3 WASM vs Pure JS Click run — —
Argon2id (16 MiB) WASM vs Pure JS Click run — —

2. Async IPC Overhead vs. Linear-Memory Arithmetic

Layer Strength Weakness / Boundary
Native WebCrypto Direct access to AES-NI, SHA-NI, ARMv8 crypto Async Promise / IPC boundary adds ~15–60 µs per small call
WebAssembly (WASM) Deterministic 32-bit unsigned ops, zero GC pauses No hardware AES-NI / SHA-NI instructions; linear heap exposed to same JS origin
Pure-ESM JS Zero binary decode, auditable text, supports newest FIPS 203/204 JS number tagging & BigInt allocations penalize bulk hashing & KDFs

3. Key Isolation Boundaries

Beyond throughput, WebCrypto uniquely offers non-extractable CryptoKey handles (extractable: false). An application can keep an HMAC or AES-GCM session key inside the browser's C++ keystore so scripts can call encrypt() or sign() without ever reading raw key material. Both WASM linear memory and JavaScript Uint8Array buffers reside in the tab's heap.

4. Browser Architecture Rulebook

  • Never re-implement AES-GCM or SHA-256 in JS/WASM when WebCrypto fits: Use SubtleCrypto whenever keys benefit from extractable: false or payloads exceed 4 KB.
  • Route BLAKE3, ChaCha20, and Argon2id through audited WASM: Recover 6×–50× compute efficiency without sacrificing zero-network offline execution.

5. Cite This Monograph (BibTeX & Markdown)

BibTeX
@techreport{encryptbench2026runtime,
  title       = {Native WebCrypto vs. Self-Hosted WASM vs. Pure JavaScript Runtimes},
  author      = {{EncryptBench Empirical Lab}},
  year        = {2026},
  month       = nov,
  institution = {EncryptBench},
  note        = {EB-Bench v1.0 Monograph CMP-06, zero-upload connect-src none harness},
  url         = {https://encryptbench.com/compare/webcrypto-vs-wasm/}
}
Markdown
[Native WebCrypto vs. Self-Hosted WASM vs. Pure JavaScript Runtimes](https://encryptbench.com/compare/webcrypto-vs-wasm/) — *EncryptBench Empirical Lab* (EB-Bench v1.0 Monograph CMP-06, Nov 2026).