CodeSampleX

Sample

adler2 2.0.1: adler2

Verified sample for cargo adler2 2.0.1: adler2. The contract ran on rust 1 · linux alpine/x64 · docker and passed: adler2 Adler32 new initializes checksum…

sha256:5abc7b15cec06f9b81d904d64c74b48e610d1481dbd851aa5a1a0047c47774dd

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux · alpine · musl x64 cargo

Verification-run environments

Environment Contract Stages Run
rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b…
2026-09-21

Case

HOW
Goal
verify adler2 in pkg:cargo/adler2@2.0.1
Packages
Symbols
  • adler2
Created
2026-09-21T03:53:13Z

Contract

  1. adler2 Adler32 new initializes checksum with default initial state sum 1
  2. adler2 adler32_slice calculates Adler-32 checksum directly on byte slices matching known test vectors
  3. adler2 Adler32 write_slice updates checksum incrementally and matches one-shot calculation
  4. adler2 Adler32 from_checksum resumes checksum calculation from a precomputed Adler-32 value
  5. adler2 Adler32 implements Hasher interface via write and finish
  6. adler2 adler32 computes checksum over a BufRead reader matching slice computation

Files

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/lib.rs
  • test/contract.rs

Download the source artifact (tar.gz)

Source

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"

[[package]]
name = "sample-adler2"
version = "1.0.0"
dependencies = [
 "adler2",
]
Cargo.toml
[package]
name = "sample-adler2"
version = "1.0.0"
edition = "2021"
publish = false

[dependencies]
adler2 = "=2.0.1"

[[bin]]
name = "contract"
path = "test/contract.rs"
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 adler2 in pkg:cargo/adler2@2.0.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/adler2@2.0.1
Demonstrate these symbols/APIs:
  - adler2

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:4d7cc22a32877e0270e5df9cb56a447df54a4865ad0d32dd3ea5223413dee384","contract":["adler2 Adler32 new initializes checksum with default initial state sum 1","adler2 adler32_slice calculates Adler-32 checksum directly on byte slices matching known test vectors","adler2 Adler32 write_slice updates checksum incrementally and matches one-shot calculation","adler2 Adler32 from_checksum resumes checksum calculation from a precomputed Adler-32 value","adler2 Adler32 implements Hasher interface via write and finish","adler2 adler32 computes checksum over a BufRead reader matching slice computation"],"goal":"verify adler2 in pkg:cargo/adler2@2.0.1","kind":"HOW","packages":["pkg:cargo/adler2@2.0.1"],"schemaVersion":1,"symbols":["adler2"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/adler2@2.0.1"],"schemaVersion":1,"subject":"pkg:cargo/adler2@2.0.1","symbols":["adler2"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify adler2 in pkg:cargo/adler2@2.0.1",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/adler2@2.0.1"
  ],
  "symbols": [
    "adler2"
  ]
}
src/lib.rs
//! Clean-room verification sample for adler2.

pub use adler2::*;
test/contract.rs
use adler2::{adler32, adler32_slice, Adler32};
use std::hash::Hasher;
use std::io::Cursor;

fn main() {
    // 1. Adler32::new initializes checksum with default initial state (sum=1)
    let default_adler = Adler32::new();
    assert_eq!(default_adler.checksum(), 1);

    // 2. adler32_slice calculates Adler-32 checksum directly on byte slices matching known test vectors
    assert_eq!(adler32_slice(&[]), 1);
    assert_eq!(adler32_slice(b"Wikipedia"), 0x11E60398);

    // 3. Adler32 write_slice updates checksum incrementally and matches one-shot calculation
    let mut incremental = Adler32::new();
    incremental.write_slice(b"Wiki");
    incremental.write_slice(b"pedia");
    assert_eq!(incremental.checksum(), 0x11E60398);

    // 4. Adler32 from_checksum resumes checksum calculation from a precomputed Adler-32 value
    let mut first_part = Adler32::new();
    first_part.write_slice(b"Wiki");
    let partial_checksum = first_part.checksum();

    let mut resumed = Adler32::from_checksum(partial_checksum);
    resumed.write_slice(b"pedia");
    assert_eq!(resumed.checksum(), 0x11E60398);

    // 5. Adler32 implements Hasher interface via write and finish
    let mut hasher = Adler32::new();
    hasher.write(b"Wikipedia");
    assert_eq!(hasher.finish(), 0x11E60398);

    // 6. adler32 computes checksum over a BufRead reader matching slice computation
    let mut reader = Cursor::new(b"Wikipedia");
    let stream_sum = adler32(&mut reader).expect("failed to calculate checksum from reader");
    assert_eq!(stream_sum, 0x11E60398);

    println!("All adler2 contract assertions passed successfully.");
}

Origin Seeder

anonymous