npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

blake3-wasm-rs

v0.6.2

Published

BLAKE3 hashing via Rust/WASM - works in Node.js (CJS + ESM), browsers, and bundlers

Readme

blake3-wasm-rs

npm version CI license npm downloads

blake3-wasm-rs is a WebAssembly port of the BLAKE3 cryptographic hash function written in Rust. It enables fast and secure hashing right inside browsers and Node.js.

build

# lets build it!

# normal
make build

# clean
make

Usage

import * as blake3 from 'blake3-wasm-rs';

const data = new TextEncoder().encode('hello world');
const key = new Uint8Array(32).fill(1);

// One-shot hashing
blake3.hash(data);
blake3.hashXof(data, 64);        // variable output length
blake3.keyedHash(data, key);     // key must be exactly 32 bytes
blake3.deriveKey('my context', key);

// Conctruct for Streaming
{
    const h = new blake3.Hasher();
    h.update(data.slice(0, 5));
    h.update(data.slice(5));
    h.finalize();
    h.finalizeXof(64);
    h.reset();
}

// Streaming
// Keyed (MAC mode)
const mac = blake3.Hasher.newKeyed(key);
mac.update(data);
mac.finalize();

// Streaming
// Key derivation mode
const kdf = blake3.Hasher.newDeriveKey('my app v1 :: subkey');
kdf.update(key);
kdf.finalize();

// Batch hashing without re-allocating
{
    const h = new blake3.Hasher();
    h.update(chunk1);
    const first = h.finalizeAndReset();
    h.update(chunk2);
    const second = h.finalizeAndReset();
}

Named imports

import { hash, hashXof, keyedHash, deriveKey, Hasher } from 'blake3-wasm-rs';

API

Functions

| Function | Returns | Description | |-----------------------------------|--------------|-------------------------------------------------| | hash(data) | Uint8Array | One-shot 32-byte BLAKE3 digest | | hashXof(data, outLen) | Uint8Array | Variable-length digest (XOF mode) | | keyedHash(data, key) | Uint8Array | Keyed hash / MAC (key must be exactly 32 bytes) | | deriveKey(context, keyMaterial) | Uint8Array | Derive a 32-byte subkey |

Hasher class

| Method | Returns | Description | |--------------------------------|--------------|-----------------------------------------------------------| | new Hasher() | Hasher | Streaming hasher, unkeyed | | Hasher.newKeyed(key) | Hasher | Streaming hasher, MAC mode (key must be exactly 32 bytes) | | Hasher.newDeriveKey(context) | Hasher | Streaming hasher, KDF mode | | .update(data) | void | Feed data, can be called multiple times | | .finalize() | Uint8Array | 32-byte digest, non-destructive | | .finalizeXof(outLen) | Uint8Array | Variable-length digest, non-destructive | | .finalizeAndReset() | Uint8Array | Finalize then reset (useful for batch hashing) | | .reset() | void | Reset to initial state, preserves mode | | .free() | void | Release WASM memory manually (prefer using instead) |

Memory management: In all modern browsers (and wasm-bindgen ≥ 0.2.91), WASM memory is freed automatically via the TC39 weak references proposal when the JS object goes out of scope.

In practice, you often don't need to think about this. For deterministic cleanup or environments without weak reference support (older browsers, some Node.js setups), use using (TypeScript 5.2+ / ES2026) or call .free() manually.

Never call .free() on a using-managed instance otherwise it will double-free.

Benchmarks

Tested on Apple M4, Node.js v24.

| Size | @noble/hashes | awasm-noble | awasm-noble (threads) | blake3-wasm | |-------|---------------|-------------|-----------------------|-------------| | 32 B | 28 MB/s | 105 MB/s | 94 MB/s | 129 MB/s | | 1 KB | 105 MB/s | 843 MB/s | 819 MB/s | 568 MB/s | | 64 KB | 102 MB/s | 1,898 MB/s | 1,855 MB/s | 2,004 MB/s | | 1 MB | 101 MB/s | 1,943 MB/s | 4,711 MB/s | 1,893 MB/s | | 10 MB | 101 MB/s | 1,911 MB/s | 6,456 MB/s | 2,185 MB/s |

Tested on Ryzen 7 5800X, Node.js v24.

| Size | @noble/hashes | awasm-noble | awasm-noble (threads) | blake3-wasm | |-------|---------------|-------------|-----------------------|-------------| | 32 B | 11 MB/s | 34 MB/s | 45 MB/s | 86 MB/s | | 1 KB | 56 MB/s | 499 MB/s | 526 MB/s | 919 MB/s | | 64 KB | 52 MB/s | 1,729 MB/s | 1,684 MB/s | 2,067 MB/s | | 1 MB | 51 MB/s | 1,550 MB/s | 4,036 MB/s | 1,848 MB/s | | 10 MB | 50 MB/s | 1,497 MB/s | 4,946 MB/s | 1,776 MB/s |

Security

The underlying blake3 Rust crate targets algorithmic constant time. However, the JavaScript boundary (via napi-rs or WASM) introduces non-determinism from the V8 runtime that is outside our control. For absolute security, use the blake3 Rust crate directly in a Rust program.

See also