Exemple
@noble/hashes 2.3.0: sha3_256
Échantillon vérifié pour npm @noble/hashes 2.3.0: sha3_256. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:e1376ea6601a220851fcf9f7cb77487b0203106f585ecab58af094b547629289
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-17 |
Cas
HOW- Objectif
- verify @noble/hashes.sha3_256 in pkg:npm/%40noble/hashes@2.3.0
- Paquets
- Symboles
-
- @noble/hashes.sha3_256
- Créé
- 2026-09-17T04:49:17Z
Contrat
- sha3_256 computes standard NIST 32-byte digest for empty input
- sha3_256 computes standard NIST 32-byte digest for byte sequence
- sha3_256 exposes blockLen 136 and outputLen 32 metadata
- sha3_256.create supports incremental hashing via update and digest
- sha3_256.create supports writing digest into preallocated buffer via digestInto
- sha3_256 throws TypeError when input is not a Uint8Array
- sha3_256 instance throws Error when digest is called more than once
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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.sha3_256 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.sha3_256
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:7fbe1f26b76a0885a31015251c8939d307e44cf789407181987f49a641afb37c","contract":["sha3_256 computes standard NIST 32-byte digest for empty input","sha3_256 computes standard NIST 32-byte digest for byte sequence","sha3_256 exposes blockLen 136 and outputLen 32 metadata","sha3_256.create supports incremental hashing via update and digest","sha3_256.create supports writing digest into preallocated buffer via digestInto","sha3_256 throws TypeError when input is not a Uint8Array","sha3_256 instance throws Error when digest is called more than once"],"goal":"verify @noble/hashes.sha3_256 in pkg:npm/%40noble/hashes@2.3.0","kind":"HOW","packages":["pkg:npm/%40noble/hashes@2.3.0"],"schemaVersion":1,"symbols":["@noble/hashes.sha3_256"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","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.sha3_256"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-noble-hashes-sha3",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-noble-hashes-sha3",
"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"
}
}
}
}
{
"name": "sample-noble-hashes-sha3",
"version": "1.0.0",
"type": "module",
"private": true,
"description": "Clean-room verification for @noble/hashes sha3_256",
"dependencies": {
"@noble/hashes": "2.3.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @noble/hashes.sha3_256 in pkg:npm/%40noble/hashes@2.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40noble/hashes@2.3.0"
],
"symbols": [
"@noble/hashes.sha3_256"
]
}
import assert from 'node:assert';
import { sha3_256 } from '@noble/hashes/sha3.js';
// 1. sha3_256 computes standard NIST 32-byte digest for empty input
const emptyDigest = sha3_256(new Uint8Array([]));
assert.strictEqual(emptyDigest.length, 32);
assert.strictEqual(
Buffer.from(emptyDigest).toString('hex'),
'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a'
);
// 2. sha3_256 computes standard NIST 32-byte digest for byte sequence
const msg = new TextEncoder().encode('abc');
const abcDigest = sha3_256(msg);
assert.strictEqual(abcDigest.length, 32);
assert.strictEqual(
Buffer.from(abcDigest).toString('hex'),
'3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532'
);
// 3. sha3_256 exposes blockLen 136 and outputLen 32 metadata
assert.strictEqual(sha3_256.blockLen, 136);
assert.strictEqual(sha3_256.outputLen, 32);
// 4. sha3_256.create supports incremental hashing via update and digest
const incremental = sha3_256.create();
incremental.update(new TextEncoder().encode('a'));
incremental.update(new TextEncoder().encode('bc'));
const incrementalDigest = incremental.digest();
assert.deepStrictEqual(incrementalDigest, abcDigest);
// 5. sha3_256.create supports writing digest into preallocated buffer via digestInto
const bufferOut = new Uint8Array(32);
const intoHasher = sha3_256.create();
intoHasher.update(msg);
intoHasher.digestInto(bufferOut);
assert.deepStrictEqual(bufferOut, abcDigest);
// 6. sha3_256 throws TypeError when input is not a Uint8Array
assert.throws(
() => {
sha3_256('abc');
},
(err) => err instanceof TypeError
);
// 7. sha3_256 instance throws Error when digest is called more than once
assert.throws(
() => {
incremental.digest();
},
(err) => err instanceof Error && /digest\(\) was already called/.test(err.message)
);
console.log('Contract passed');
Seeder d'origine
anonyme