@noble/hashes blake3 and sha256 digests: working versions (tested 2026-10-15)
Hash utf8 bytes with @noble/hashes blake3 and sha256, comparing hex digests offline.
passed2 passed · 0 failed2026-10-15 20:57 UTC- Status
- passed
- Last passed
- 2026-10-15 20:57 UTC
- Tests
- 2 / 2
- Language
- TypeScript
- Runtime
- node v22.23.3
pinned versions3
@noble/hashes@2.4.0@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false npm test
test environment
node v22.23.3 linux 6.17.0-1022-azure x64 runner: github-actions 38805962781
The code
Exactly the files that passed. Your agent can pull them with get_recipe("noble-hashes-blake3-sha256") (install), or see them on GitHub.
package.json
{
"name": "noble-hashes-blake3-sha256",
"private": true,
"type": "module",
"scripts": {
"test": "node --import tsx --test test/*.test.ts"
},
"dependencies": {
"@noble/hashes": "2.4.0"
},
"devDependencies": {
"@types/node": "26.6.5",
"tsx": "4.23.15"
}
}
src/hash.ts
import { sha256 } from "@noble/hashes/sha2.js";
import { blake3 } from "@noble/hashes/blake3.js";
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
export function sha256Hex(input: string) {
return bytesToHex(sha256(utf8ToBytes(input)));
}
export function blake3Hex(input: string) {
return bytesToHex(blake3(utf8ToBytes(input)));
}
test/hash.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { blake3Hex, sha256Hex } from "../src/hash.ts";
test("sha256 matches known empty digest", () => {
assert.equal(
sha256Hex(""),
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
);
});
test("blake3 is deterministic and distinct from sha256", () => {
const a = blake3Hex("provenpin");
const b = blake3Hex("provenpin");
assert.equal(a, b);
assert.equal(a.length, 64);
assert.notEqual(a, sha256Hex("provenpin"));
});
Connect to ProvenPin
Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.
terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp
~/.cursor/mcp.json
{ "mcpServers": { "provenpin": { "url": "https://mcp.provenpin.com/mcp" } } }.vscode/mcp.json
{ "servers": { "provenpin": { "type": "http", "url": "https://mcp.provenpin.com/mcp" } } }~/.codeium/windsurf/mcp_config.json
{ "mcpServers": { "provenpin": { "serverUrl": "https://mcp.provenpin.com/mcp" } } }MCP settings
{ "mcpServers": { "provenpin": { "type": "streamableHttp", "url": "https://mcp.provenpin.com/mcp" } } }Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.