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

@merkleforge/hash

v0.2.3

Published

SHA-256, Keccak-256, and BLAKE3 hash functions for Merkle trees, with domain-separated leaf and node hashing. Pure JS on @noble/hashes. Part of MerkleForge.

Readme

@merkleforge/hash provides ready-made HashFunction adapters in pure JavaScript. SHA-256 and BLAKE3 come from @noble/hashes; Keccak-256 uses MerkleForge's own unrolled sponge, about 2x faster than noble's on the short inputs trees hash (measured) and tested against it byte for byte. Every tree in @merkleforge/variants takes one, so switching algorithms is a one-word change, and each produces the same digests as the Rust merkleforge-hash crate.

Formerly published as @1888-labs/merkle-hash (deprecated). From 0.2.0, install @merkleforge/hash; the API is unchanged.

Install

npm i @merkleforge/hash @merkleforge/core

Usage

import { utf8 } from '@merkleforge/core'
import { Blake3, Keccak256, Sha256 } from '@merkleforge/hash'
import { BinaryMerkleTree } from '@merkleforge/variants'

Keccak256.hash(utf8('leaf')) // Keccak-256(0x00 || "leaf")

const tree = BinaryMerkleTree.fromLeaves(Blake3, [utf8('a'), utf8('b')])

Adapters

| Adapter | Leaf hash | Node hash | Use it for | |---------|-----------|-----------|------------| | Sha256 | SHA-256(0x00 \|\| data) | SHA-256(0x01 \|\| left \|\| right) | General use, Bitcoin-style systems | | Keccak256 | Keccak-256(0x00 \|\| data) | Keccak-256(0x01 \|\| left \|\| right) | Ethereum, Solidity verifiers, Patricia tries | | Blake3 | BLAKE3 derive_key leaf context | BLAKE3 derive_key node context | Systems already built on BLAKE3 |

The 0x00 / 0x01 prefixes keep a leaf from being passed off as an internal node (second-preimage protection). With Keccak256, MerklePatriciaTrie hashes nodes with plain Keccak-256, so its roots match Ethereum.

Keccak256 also implements the optional batch methods hashNodePairs and hashLeaves, which trees use to hash a whole layer without allocating a digest per node.

keccak256(data, more?) is plain Keccak-256 with no domain prefix (of data || more when more is given), the same as keccak_256 from @noble/hashes.

For WebAssembly hashing that builds trees 3–7x faster again (6.5x at 131,072 leaves, see BENCHMARKS.md), use @merkleforge/hash-wasm, which returns the same digests.

Part of MerkleForge

MerkleForge is a set of authenticated data structures for Rust and TypeScript with matching roots and proofs across languages. All TypeScript packages share one version.

| Package | What it holds | |---------|---------------| | @merkleforge/core | Interfaces, proof types, errors, codecs, and byte helpers | | @merkleforge/hash | SHA-256, Keccak-256, and BLAKE3 adapters | | @merkleforge/hash-wasm | WebAssembly Keccak-256 and SHA-256, same digests, faster | | @merkleforge/variants | Binary, Sparse, and Patricia trees, multiproofs, codecs | | @merkleforge/ethereum | Verify eth_getProof account and storage proofs | | @merkleforge/openzeppelin | OpenZeppelin-compatible StandardMerkleTree and SimpleMerkleTree |

Staging builds from develop are published under the next tag (npm i @merkleforge/hash@next). MerkleForge has not been independently audited; report vulnerabilities via the security policy.

License

Licensed under either of MIT or Apache-2.0 at your option.


Maintained by 1888 Labs and open-source contributors.