Exemple
bun 1.3.14: CryptoHasher, CryptoHasher.update, CryptoHasher.digest
Échantillon vérifié pour npm bun 1.3.14: CryptoHasher, CryptoHasher.update, CryptoHasher.digest. Le contrat s'est exécuté sur bun 1 · linux alpine/x64 …
sha256:884a8685fa8d90916655ba691e2b11e038ba3c1e7a7ddc56adcd551085c8a05a
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
- 2
- Clés de signature qui l’ont compilé
- 2
Environnement déclaré
bun 1 linux x64 bun 1 javascript bun
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| bun 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-19 |
| bun 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1oven/bun:1-alpine@sha256:07235578f79e… |
2026-09-07 |
Cas
HOW- Objectif
- verify Bun.CryptoHasher in pkg:npm/bun@1.3.14
- Paquets
- Symboles
-
- Bun.CryptoHasher
- Bun.CryptoHasher.update
- Bun.CryptoHasher.digest
- Environnement
- bun 1
- Créé
- 2026-08-18T13:32:46Z
Contrat
- Bun.CryptoHasher computes cryptographic hashes natively with support for sha256, sha512, and md5 algorithms.
- Bun.CryptoHasher.update supports incremental streaming input chunks.
- Bun.CryptoHasher.digest returns raw Uint8Array, hex, and base64 encoded strings according to the requested encoding parameter.
Fichiers
- PROMPT.md
- csx.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 Bun.CryptoHasher in pkg:npm/bun@1.3.14
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bun@1.3.14
Demonstrate these symbols/APIs:
- Bun.CryptoHasher
Required runtime conditions:
- ecosystem: golang
- language: go
- packageManager: go@1.26.5
- runtime: go@1.26.5
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:1d2bc513cdb518046919a5375468fadccddb71a905c0d5340237cbb1c2a5e71f","contract":["Bun.CryptoHasher computes cryptographic hashes natively with support for sha256, sha512, and md5 algorithms.","Bun.CryptoHasher.update supports incremental streaming input chunks.","Bun.CryptoHasher.digest returns raw Uint8Array, hex, and base64 encoded strings according to the requested encoding parameter."],"goal":"verify Bun.CryptoHasher in pkg:npm/bun@1.3.14","kind":"HOW","packages":["pkg:npm/bun@1.3.14"],"schemaVersion":1,"symbols":["Bun.CryptoHasher","Bun.CryptoHasher.update","Bun.CryptoHasher.digest"]},"contractCommand":["bun","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","executionContext":"bun","language":"javascript","moduleSystem":"esm","os":"linux","packageManager":"bun","runtime":"bun","runtimeVersion":"1","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/bun@1.3.14"],"schemaVersion":1,"symbols":["Bun.CryptoHasher","Bun.CryptoHasher.update","Bun.CryptoHasher.digest"],"verifierAdapter":"npm@1"}
{
"name": "csx-bun-cryptohasher-contract",
"version": "1.0.0",
"private": true,
"type": "module"
}
{
"schemaVersion": 1,
"goal": "verify Bun.CryptoHasher in pkg:npm/bun@1.3.14",
"kind": "HOW",
"packages": [
"pkg:npm/bun@1.3.14"
],
"symbols": [
"Bun.CryptoHasher"
],
"runtimeConditions": {
"ecosystem": "golang",
"language": "go",
"packageManager": "go@1.26.5",
"runtime": "go@1.26.5"
}
}
import assert from 'node:assert/strict';
assert.equal(typeof Bun, 'object', 'Bun global is present');
assert.equal(typeof Bun.CryptoHasher, 'function', 'Bun.CryptoHasher constructor is present');
// 1. Basic SHA-256 hashing
const hasher = new Bun.CryptoHasher('sha256');
hasher.update('hello world');
const hexDigest = hasher.digest('hex');
assert.equal(hexDigest, 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9');
// 2. Incremental streaming updates
const streamHasher = new Bun.CryptoHasher('sha256');
streamHasher.update('hello ');
streamHasher.update('world');
assert.equal(streamHasher.digest('hex'), 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9');
// 3. Binary Uint8Array digest
const rawHasher = new Bun.CryptoHasher('sha256');
rawHasher.update('hello world');
const rawDigest = rawHasher.digest();
assert(rawDigest instanceof Uint8Array);
assert.equal(rawDigest.length, 32);
// 4. Base64 encoding format
const b64Hasher = new Bun.CryptoHasher('sha256');
b64Hasher.update('hello world');
assert.equal(b64Hasher.digest('base64'), Buffer.from(rawDigest).toString('base64'));
// 5. Multiple hash algorithms (md5, sha512)
const md5Hasher = new Bun.CryptoHasher('md5');
md5Hasher.update('hello world');
assert.equal(md5Hasher.digest('hex'), '5eb63bbbe01eeed093cb22bb8f5acdc3');
const sha512Hasher = new Bun.CryptoHasher('sha512');
sha512Hasher.update('hello world');
assert.equal(sha512Hasher.digest('hex').length, 128);
console.log('CONTRACT PASS: Bun.CryptoHasher supports incremental hashing and multiple output encodings');
Seeder d'origine
anonyme