CodeSampleX

샘플

imurmurhash 0.1.4

검증된 샘플 — npm imurmurhash 0.1.4. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert MurmurHash3 creates a hash instance and calculates 32-bit…

sha256:7de2781e33dd2bf3cfedbaada2e49afd8d792ec2f05bcd09b9ec8f44f1cc8a65

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20

케이스

HOW
목표
verify pkg:npm/imurmurhash@0.1.4
패키지
환경
node 22.23.2
생성일
2026-08-20T14:46:21Z

컨트랙트

  1. assert MurmurHash3 creates a hash instance and calculates 32-bit unsigned integer hash
  2. assert MurmurHash3 supports incremental string hashing matching single-pass calculation
  3. assert MurmurHash3 accepts custom seed affecting hash output
  4. assert MurmurHash3 supports reset method for reusing instance with optional new seed
  5. assert MurmurHash3 without new uses cached instance and resets on each call

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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 pkg:npm/imurmurhash@0.1.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/imurmurhash@0.1.4
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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.
csx.json
{"case":{"caseId":"case:sha256:c9017b421fa18b77c077ec9df052b68f09357134c6c3d0faadcb33c4ec4d49f7","constraints":{"executionContext":"node"},"contract":["assert MurmurHash3 creates a hash instance and calculates 32-bit unsigned integer hash","assert MurmurHash3 supports incremental string hashing matching single-pass calculation","assert MurmurHash3 accepts custom seed affecting hash output","assert MurmurHash3 supports reset method for reusing instance with optional new seed","assert MurmurHash3 without new uses cached instance and resets on each call"],"goal":"verify pkg:npm/imurmurhash@0.1.4","kind":"HOW","packages":["pkg:npm/imurmurhash@0.1.4"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/imurmurhash@0.1.4"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-imurmurhash",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-imurmurhash",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "imurmurhash": "0.1.4"
      }
    },
    "node_modules/imurmurhash": {
      "version": "0.1.4",
      "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
      "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
      "license": "MIT",
      "engines": {
        "node": ">=0.8.19"
      }
    }
  }
}
package.json
{
  "name": "sample-imurmurhash",
  "version": "1.0.0",
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "imurmurhash": "0.1.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/imurmurhash@0.1.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/imurmurhash@0.1.4"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const MurmurHash3 = require('imurmurhash');

// 1. Export verification
assert.equal(typeof MurmurHash3, 'function', 'MurmurHash3 must be a function');

// 2. Hash calculation returning 32-bit unsigned integer
const h1 = MurmurHash3('hello world').result();
assert.equal(typeof h1, 'number');
assert.equal(Number.isInteger(h1), true);
assert.equal(h1 >= 0 && h1 <= 0xffffffff, true);
assert.equal(h1, 1586663183);

// 3. Incremental string hashing matches single-pass calculation
const full = 'The quick brown fox jumps over the lazy dog';
const singlePass = new MurmurHash3(full).result();

const incremental = new MurmurHash3()
  .hash('The quick ')
  .hash('brown fox ')
  .hash('jumps over ')
  .hash('the lazy dog')
  .result();

assert.equal(incremental, singlePass);

// 4. Custom seed parameter alters hash output
const seedVal = 42;
const unseeded = new MurmurHash3('sample text').result();
const seeded = new MurmurHash3('sample text', seedVal).result();
assert.equal(typeof seeded, 'number');
assert.notEqual(seeded, unseeded);

const seededIncremental = new MurmurHash3(undefined, seedVal).hash('sample text').result();
assert.equal(seededIncremental, seeded);

// 5. Reset method clears state and allows reuse with optional seed
const reusable = new MurmurHash3('initial');
reusable.reset();
reusable.hash('new string');
assert.equal(reusable.result(), new MurmurHash3('new string').result());

reusable.reset(999);
reusable.hash('new string');
assert.equal(reusable.result(), new MurmurHash3('new string', 999).result());

// 6. Function call without new uses cached singleton instance
const state1 = MurmurHash3('test-string');
assert.equal(state1.result(), new MurmurHash3('test-string').result());

const state2 = MurmurHash3('another-string');
assert.equal(state2.result(), new MurmurHash3('another-string').result());
assert.equal(state1, state2);

console.log('Contract tests passed successfully.');

오리진 시더

익명