Sample
ring 0.17.14: ring::digest::Algorithm
Verified sample for cargo ring 0.17.14: ring::digest::Algorithm. The contract ran on rust 1 · linux alpine/x64 · docker and passed.
sha256:f1218bdb09d683e702685be23caa9318309017bad748005cbf50b85e4a02c283
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-20 |
Case
HOW- Goal
- verify ring::digest::Algorithm in pkg:cargo/ring@0.17.14
- Packages
- Symbols
-
- ring::digest::Algorithm
- Created
- 2026-09-20T17:04:47Z
Contract
- Algorithm output_len, block_len, and chaining_len report standard digest dimensions for SHA256, SHA384, SHA512, SHA512_256, and SHA1_FOR_LEGACY_USE_ONLY
- Algorithm implements PartialEq and Eq distinguishing distinct algorithms and equating identical algorithm references
- Algorithm implements Debug formatting the algorithm identifier
- digest and Context accept an Algorithm reference to calculate matching digests of length algorithm.output_len()
Files
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Source
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "cc"
version = "1.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54413ede23c2daf518f35156dfde027feb2374004d63bd497f983c8db9c0e313"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]]
name = "cfg-if"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
[[package]]
name = "find-msvc-tools"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25905e51abafe4dcea6c15fec58c57b601cdbd0ee53d22ea1d3016c587d39b"
[[package]]
name = "getrandom"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"untrusted",
"windows-sys",
]
[[package]]
name = "sample-ring-digest-algorithm"
version = "1.0.0"
dependencies = [
"ring",
]
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[package]
name = "sample-ring-digest-algorithm"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
ring = "=0.17.14"
[[bin]]
name = "contract"
path = "test/contract.rs"
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 ring::digest::Algorithm in pkg:cargo/ring@0.17.14
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/ring@0.17.14
Demonstrate these symbols/APIs:
- ring::digest::Algorithm
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:52e0c69e3a39cdccbe9244badae09781e36247e2ad80b0ebf402d0dedd53750a","contract":["Algorithm output_len, block_len, and chaining_len report standard digest dimensions for SHA256, SHA384, SHA512, SHA512_256, and SHA1_FOR_LEGACY_USE_ONLY","Algorithm implements PartialEq and Eq distinguishing distinct algorithms and equating identical algorithm references","Algorithm implements Debug formatting the algorithm identifier","digest and Context accept an Algorithm reference to calculate matching digests of length algorithm.output_len()"],"goal":"verify ring::digest::Algorithm in pkg:cargo/ring@0.17.14","kind":"HOW","packages":["pkg:cargo/ring@0.17.14"],"schemaVersion":1,"symbols":["ring::digest::Algorithm"]},"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/ring@0.17.14"],"schemaVersion":1,"subject":"pkg:cargo/ring@0.17.14","symbols":["ring::digest::Algorithm"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify ring::digest::Algorithm in pkg:cargo/ring@0.17.14",
"kind": "HOW",
"packages": [
"pkg:cargo/ring@0.17.14"
],
"symbols": [
"ring::digest::Algorithm"
]
}
//! Clean-room verification sample for ring::digest::Algorithm.
pub use ring::digest::{
Algorithm, Context, Digest, SHA1_FOR_LEGACY_USE_ONLY, SHA256, SHA384, SHA512, SHA512_256,
};
use ring::digest::{
self, Algorithm, Context, SHA1_FOR_LEGACY_USE_ONLY, SHA256, SHA384, SHA512, SHA512_256,
};
fn main() {
// 1. Algorithm::output_len, block_len, and chaining_len return standard digest dimensions
assert_eq!(SHA256.output_len(), 32);
assert_eq!(SHA256.block_len(), 64);
assert_eq!(SHA256.chaining_len(), 32);
assert_eq!(SHA384.output_len(), 48);
assert_eq!(SHA384.block_len(), 128);
assert_eq!(SHA384.chaining_len(), 64);
assert_eq!(SHA512.output_len(), 64);
assert_eq!(SHA512.block_len(), 128);
assert_eq!(SHA512.chaining_len(), 64);
assert_eq!(SHA512_256.output_len(), 32);
assert_eq!(SHA512_256.block_len(), 128);
assert_eq!(SHA512_256.chaining_len(), 64);
assert_eq!(SHA1_FOR_LEGACY_USE_ONLY.output_len(), 20);
assert_eq!(SHA1_FOR_LEGACY_USE_ONLY.block_len(), 64);
assert_eq!(SHA1_FOR_LEGACY_USE_ONLY.chaining_len(), 20);
// 2. Algorithm implements PartialEq and Eq distinguishing distinct algorithms
let alg_ref_1: &Algorithm = &SHA256;
let alg_ref_2: &Algorithm = &SHA256;
assert_eq!(alg_ref_1, alg_ref_2);
assert_ne!(alg_ref_1, &SHA384);
assert_ne!(&SHA512, &SHA512_256);
assert_ne!(&SHA256, &SHA1_FOR_LEGACY_USE_ONLY);
// 3. Algorithm implements Debug formatting the algorithm identifier
assert_eq!(format!("{:?}", &SHA256), "SHA256");
assert_eq!(format!("{:?}", &SHA384), "SHA384");
assert_eq!(format!("{:?}", &SHA512), "SHA512");
assert_eq!(format!("{:?}", &SHA512_256), "SHA512_256");
assert_eq!(format!("{:?}", &SHA1_FOR_LEGACY_USE_ONLY), "SHA1");
// 4. digest and Context accept an Algorithm reference to calculate matching digests
let data = b"The quick brown fox jumps over the lazy dog";
let algorithms: [&Algorithm; 5] = [
&SHA256,
&SHA384,
&SHA512,
&SHA512_256,
&SHA1_FOR_LEGACY_USE_ONLY,
];
for &alg in &algorithms {
let one_shot = digest::digest(alg, data);
assert_eq!(one_shot.algorithm(), alg);
assert_eq!(one_shot.as_ref().len(), alg.output_len());
let mut ctx = Context::new(alg);
assert_eq!(ctx.algorithm(), alg);
ctx.update(&data[..15]);
ctx.update(&data[15..]);
let multi_step = ctx.finish();
assert_eq!(multi_step.algorithm(), alg);
assert_eq!(one_shot.as_ref(), multi_step.as_ref());
}
println!("All ring::digest::Algorithm contract assertions passed successfully.");
}
Origin Seeder
anonymous