샘플
@noble/hashes 2.3.0: blake3
검증된 샘플 — npm @noble/hashes 2.3.0: blake3. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: blake3 exports function with outputLen 32 blockLen 64…
sha256:8346a625e237e65c4e0e638eff7285eca78b1df76ec02f5a556d30e0c543132a
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-06 |
케이스
HOW- 목표
- verify @noble/hashes.blake3 in pkg:npm/%40noble/hashes@2.3.0
- 심벌
-
- @noble/hashes.blake3
- 환경
- node 22.23.2
- 생성일
- 2026-09-06T12:13:40Z
컨트랙트
- blake3 exports function with outputLen 32 blockLen 64 canXOF true and create function
- blake3 computes standard 32-byte hash from Uint8Array matching official BLAKE3 test vectors
- blake3 supports incremental hashing via create update and digest yielding identical output to one-shot
- blake3 supports optional 32-byte key for keyed MAC computation
- blake3 supports optional context for key derivation function mode
- blake3 supports extendable output via dkLen option and xof method
- blake3 throws TypeError or Error when input is not Uint8Array or when key length is invalid or when key and context are both provided
파일
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify @noble/hashes.blake3 in pkg:npm/%40noble/hashes@2.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40noble/hashes@2.3.0
Demonstrate these symbols/APIs:
- @noble/hashes.blake3
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:62642f990d40e22d73d135380dde01b28d3b88c5cf09218355c3a31e352a4f07","contract":["blake3 exports function with outputLen 32 blockLen 64 canXOF true and create function","blake3 computes standard 32-byte hash from Uint8Array matching official BLAKE3 test vectors","blake3 supports incremental hashing via create update and digest yielding identical output to one-shot","blake3 supports optional 32-byte key for keyed MAC computation","blake3 supports optional context for key derivation function mode","blake3 supports extendable output via dkLen option and xof method","blake3 throws TypeError or Error when input is not Uint8Array or when key length is invalid or when key and context are both provided"],"goal":"verify @noble/hashes.blake3 in pkg:npm/%40noble/hashes@2.3.0","kind":"HOW","packages":["pkg:npm/%40noble/hashes@2.3.0"],"schemaVersion":1,"symbols":["@noble/hashes.blake3"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40noble/hashes@2.3.0"],"schemaVersion":1,"subject":"pkg:npm/%40noble/hashes@2.3.0","symbols":["@noble/hashes.blake3"],"verifierAdapter":"node-typescript@1"}
import { blake3 } from '@noble/hashes/blake3.js';
/**
* Computes BLAKE3 hash of the given byte array.
*
* @param {Uint8Array} data
* @param {object} [opts]
* @returns {Uint8Array}
*/
export function hashBlake3(data, opts) {
return blake3(data, opts);
}
/**
* Creates an incremental BLAKE3 hasher instance.
*
* @param {object} [opts]
* @returns {object}
*/
export function createBlake3(opts) {
return blake3.create(opts);
}
export { blake3 };
export default blake3;
{
"name": "sample-noble-hashes-blake3",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-noble-hashes-blake3",
"version": "1.0.0",
"dependencies": {
"@noble/hashes": "2.3.0"
}
},
"node_modules/@noble/hashes": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.3.0.tgz",
"integrity": "sha512-oN+QwyX7VSHotibwubG3kpzbwKrfnyR6OOO+3Nk/53ADL7FmgHHz4TgrbaYKvvOw09u6QTx0oiH1cNCIOuN0CQ==",
"license": "MIT",
"engines": {
"node": ">= 20.19.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
}
}
}
{
"name": "sample-noble-hashes-blake3",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"@noble/hashes": "2.3.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @noble/hashes.blake3 in pkg:npm/%40noble/hashes@2.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40noble/hashes@2.3.0"
],
"symbols": [
"@noble/hashes.blake3"
]
}
import assert from 'node:assert/strict';
import { blake3, hashBlake3, createBlake3 } from '../index.mjs';
function toHex(bytes) {
return Buffer.from(bytes).toString('hex');
}
// 1. blake3 exports function with outputLen 32 blockLen 64 canXOF true and create function
{
assert.strictEqual(typeof blake3, 'function', 'blake3 should be a function');
assert.strictEqual(blake3.outputLen, 32, 'outputLen should be 32');
assert.strictEqual(blake3.blockLen, 64, 'blockLen should be 64');
assert.strictEqual(blake3.canXOF, true, 'canXOF should be true');
assert.strictEqual(typeof blake3.create, 'function', 'blake3.create should be a function');
assert.strictEqual(typeof hashBlake3, 'function', 'hashBlake3 helper should be a function');
assert.strictEqual(typeof createBlake3, 'function', 'createBlake3 helper should be a function');
}
// 2. blake3 computes standard 32-byte hash from Uint8Array matching official BLAKE3 test vectors
{
const emptyHash = blake3(new Uint8Array(0));
assert.strictEqual(emptyHash instanceof Uint8Array, true);
assert.strictEqual(emptyHash.length, 32);
assert.strictEqual(
toHex(emptyHash),
'af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262',
'empty input hash must match official BLAKE3 vector'
);
const abc = new Uint8Array([0x61, 0x62, 0x63]);
const abcHash = hashBlake3(abc);
assert.strictEqual(abcHash.length, 32);
assert.strictEqual(
toHex(abcHash),
'6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85',
'abc hash must match official BLAKE3 vector'
);
}
// 3. blake3 supports incremental hashing via create update and digest yielding identical output to one-shot
{
const part1 = new Uint8Array([1, 2, 3, 4, 5]);
const part2 = new Uint8Array([6, 7, 8, 9, 10]);
const full = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const hasher = createBlake3();
hasher.update(part1);
hasher.update(part2);
const digest = hasher.digest();
const oneShot = blake3(full);
assert.deepStrictEqual(digest, oneShot, 'incremental hash must equal one-shot hash');
}
// 4. blake3 supports optional 32-byte key for keyed MAC computation
{
const msg = new Uint8Array([0x61, 0x62, 0x63]);
const key = new Uint8Array(32).fill(0x42);
const keyed = blake3(msg, { key });
const unkeyed = blake3(msg);
assert.strictEqual(keyed.length, 32);
assert.notDeepStrictEqual(keyed, unkeyed, 'keyed hash must differ from unkeyed hash');
const keyedHasher = blake3.create({ key });
keyedHasher.update(msg);
assert.deepStrictEqual(keyedHasher.digest(), keyed, 'incremental keyed hash must match one-shot keyed hash');
}
// 5. blake3 supports optional context for key derivation function mode
{
const msg = new Uint8Array([0x61, 0x62, 0x63]);
const context = new Uint8Array([0x61, 0x70, 0x70]);
const kdf = blake3(msg, { context });
const unkeyed = blake3(msg);
assert.strictEqual(kdf.length, 32);
assert.notDeepStrictEqual(kdf, unkeyed, 'derived key must differ from default hash');
}
// 6. blake3 supports extendable output via dkLen option and xof method
{
const msg = new Uint8Array([0x61, 0x62, 0x63]);
const abcHash = blake3(msg);
for (const dkLen of [16, 32, 64, 128]) {
const out = blake3(msg, { dkLen });
assert.strictEqual(out.length, dkLen, `digest length must match dkLen ${dkLen}`);
}
const xof64 = blake3(msg, { dkLen: 64 });
assert.strictEqual(xof64.length, 64);
assert.deepStrictEqual(xof64.subarray(0, 32), abcHash, 'first 32 bytes must match default digest');
const hasher = blake3.create();
hasher.update(msg);
const xofOut = hasher.xof(64);
assert.deepStrictEqual(xofOut, xof64, 'hasher xof must match one-shot xof output');
}
// 7. blake3 throws TypeError or Error when input is not Uint8Array or when key length is invalid or when key and context are both provided
{
const msg = new Uint8Array([0x61, 0x62, 0x63]);
const key = new Uint8Array(32).fill(0x42);
const context = new Uint8Array([0x61, 0x70, 0x70]);
assert.throws(
() => blake3('not bytes'),
/Uint8Array/i,
'should throw when input is not Uint8Array'
);
assert.throws(
() => blake3([1, 2, 3]),
/Uint8Array/i,
'should throw when input is an array'
);
assert.throws(
() => blake3(msg, { key: new Uint8Array(16) }),
/key/i,
'should throw when key length is not 32 bytes'
);
assert.throws(
() => blake3(msg, { key, context }),
/cannot use both "key" and "context"/i,
'should throw when both key and context are provided'
);
}
console.log('All @noble/hashes.blake3 contract assertions passed.');
오리진 시더
익명