Blake3 for WebAssembly
npm install blake3-wasm-vn``js
const { hash, hashToHex, keyedHash, verifyKeyedHash, deriveKey, deriveKeyHex } = require('blake3-wasm-vn/nodejs');
`
`js
import { hash, hashToHex, keyedHash, verifyKeyedHash, deriveKey, deriveKeyHex }s from 'blake3-wasm-vn/deno';
`
`js
import init, { hash, hashToHex, keyedHash, verifyKeyedHash, deriveKey, deriveKeyHex } from 'blake3-wasm-vn/web';
await init();
// Classic
const data = new TextEncoder().encode("hello world");
console.log("hash 32 bytes: ", hash(data));
console.log("hash 32 bytes (hex): ", hashToHex(data));
``
| (index) | Task name | Latency avg (ns) | Latency med (ns) | Throughput avg (ops/s) | Throughput med (ops/s) | Samples |
|---------|--------------------|------------------|------------------|------------------------|------------------------|---------|
| 0 | 'hash - 32 bytes' | '3456.0 ± 4.31%' | '0.00 ± 0.00' | '279710 ± 0.15%' | '289355 ± 0' | 57900 |
| 1 | 'hash - 64 bytes' | '3652.7 ± 4.31%' | '0.00 ± 0.00' | '264148 ± 0.16%' | '273768 ± 0' | 54781 |
| 2 | 'hash - 128 bytes' | '4004.5 ± 4.30%' | '0.00 ± 0.00' | '240125 ± 0.17%' | '249720 ± 0' | 49969 |