Check if WASM acceleration is available.
The compiled WebAssembly module, or null if not loaded.
Initialize the WASM module from a .wasm file or buffer.
OptionalwasmSource: BufferSource | ResponseGet current WASM status.
Hash data with the WebAssembly module when one is loaded, otherwise with crypto-lib.
A crypto-lib hash name ("sha256", "sha384",
"sha512", "sha3-256", "sha3-512", "blake2b", "blake3");
"SHA-256" and "sha-512" are read as "sha256" and "sha512".
Raw bytes to hash.
The hash digest as a Uint8Array.
ML-KEM-768 post-quantum key encapsulation.
Routes to WebAssembly implementation when available; falls back transparently to pure-JS implementation.
ML-KEM-768 post-quantum key decapsulation.
Routes to WebAssembly implementation when available; falls back transparently to pure-JS implementation.
ML-DSA-65 post-quantum digital signature generation.
Routes to WebAssembly implementation when available; falls back transparently to pure-JS implementation.
ML-DSA-65 post-quantum digital signature verification.
Routes to WebAssembly implementation when available; falls back transparently to pure-JS implementation.
Benchmark a hash operation: crypto-lib against this accelerator's WasmAccelerator.hash, which is crypto-lib too until a WebAssembly module is loaded.
"hash-sha256", "hash-sha512" or "hash-blake3".
Number of iterations (default 1000).
Benchmark results with timing and speedup ratio.
Reset the accelerator, releasing the WASM module.
WebAssembly cryptographic accelerator.
When the WASM module is available, routes heavy operations through near-native WASM code. Falls back transparently to the JavaScript implementation when WASM is not loaded.
Auto-detection: crypto-lib checks for this package at import time. If installed, heavy operations are automatically routed through WASM.
Example