Ejemplo
bun 1.3.14: CryptoHasher, CryptoHasher.update, CryptoHasher.digest
Muestra verificada para npm bun 1.3.14: CryptoHasher, CryptoHasher.update, CryptoHasher.digest. El contrato se ejecutó en bun 1 · linux alpine/x64 · docker y…
sha256:884a8685fa8d90916655ba691e2b11e038ba3c1e7a7ddc56adcd551085c8a05a
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 2
- Claves de firma que lo compilaron
- 2
Entorno declarado
bun 1 linux x64 bun 1 javascript bun
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify Bun.CryptoHasher in pkg:npm/bun@1.3.14
- Paquetes
- Símbolos
-
- Bun.CryptoHasher
- Bun.CryptoHasher.update
- Bun.CryptoHasher.digest
- Entorno
- bun 1
- Creado
- 2026-08-18T13:32:46Z
Contrato
- 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.
Archivos
- PROMPT.md
- csx.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 de origen
anónimo