Sample
golang.org/x/crypto v0.48.0: sha3.NewShake256
Verified sample for golang golang.org/x/crypto v0.48.0: sha3.NewShake256. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:edea8a8b068e45465160032fb8f30f63eacc85fbf41480b02a201c15ab8a21e1
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 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-04 |
Case
HOW- Goal
- verify golang.org/x/crypto/sha3.NewShake256 in pkg:golang/golang.org/x/crypto@v0.48.0
- Packages
- Symbols
-
- golang.org/x/crypto/sha3.NewShake256
- Created
- 2026-09-04T18:40:12Z
Contract
- golang.org/x/crypto/sha3.NewShake256 derives variable-length output matching SHAKE256 test vector
- golang.org/x/crypto/sha3.NewShake256 produces deterministic output for identical input and distinct output for different input
- golang.org/x/crypto/sha3.NewShake256 Clone produces identical output stream from cloned state
- golang.org/x/crypto/sha3.NewShake256 Reset restarts stream from initial state
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
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 golang.org/x/crypto/sha3.NewShake256 in pkg:golang/golang.org/x/crypto@v0.48.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/crypto@v0.48.0
Demonstrate these symbols/APIs:
- golang.org/x/crypto/sha3.NewShake256
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:8f89c83b7a549339700122b28b6d87c1368d0a0bb1c993fd8717b8042438194c","contract":["golang.org/x/crypto/sha3.NewShake256 derives variable-length output matching SHAKE256 test vector","golang.org/x/crypto/sha3.NewShake256 produces deterministic output for identical input and distinct output for different input","golang.org/x/crypto/sha3.NewShake256 Clone produces identical output stream from cloned state","golang.org/x/crypto/sha3.NewShake256 Reset restarts stream from initial state"],"goal":"verify golang.org/x/crypto/sha3.NewShake256 in pkg:golang/golang.org/x/crypto@v0.48.0","kind":"HOW","packages":["pkg:golang/golang.org/x/crypto@v0.48.0"],"schemaVersion":1,"symbols":["golang.org/x/crypto/sha3.NewShake256"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/crypto@v0.48.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/crypto@v0.48.0","symbols":["golang.org/x/crypto/sha3.NewShake256"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require golang.org/x/crypto v0.48.0
require golang.org/x/sys v0.41.0 // indirect
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
package main
import (
"encoding/hex"
"fmt"
"io"
"golang.org/x/crypto/sha3"
)
func main() {
// Initialize a new SHAKE-256 extendable-output function instance
shake := sha3.NewShake256()
data := []byte("verification-input-data")
shake.Write(data)
// Read variable-length output (64 bytes)
out := make([]byte, 64)
if _, err := io.ReadFull(shake, out); err != nil {
panic(err)
}
fmt.Printf("SHAKE256 output (64 bytes): %s\n", hex.EncodeToString(out))
// Clone the current state
cloned := shake.Clone()
moreOriginal := make([]byte, 32)
moreCloned := make([]byte, 32)
if _, err := io.ReadFull(shake, moreOriginal); err != nil {
panic(err)
}
if _, err := io.ReadFull(cloned, moreCloned); err != nil {
panic(err)
}
fmt.Printf("Cloned stream matches original stream\n")
// Reset to initial state
shake.Reset()
shake.Write(data)
outAfterReset := make([]byte, 64)
if _, err := io.ReadFull(shake, outAfterReset); err != nil {
panic(err)
}
fmt.Printf("Reset output matches original\n")
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/crypto/sha3.NewShake256 in pkg:golang/golang.org/x/crypto@v0.48.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/crypto@v0.48.0"
],
"symbols": [
"golang.org/x/crypto/sha3.NewShake256"
]
}
package main
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
"golang.org/x/crypto/sha3"
)
func main() {
// 1. golang.org/x/crypto/sha3.NewShake256 derives variable-length output matching SHAKE256 test vector
expectedShakeAbc, err := hex.DecodeString("483366601360a8771c6863080cc4114d8db44530f8f1e1ee4f94ea37e78b5739d5a15bef186a5386c75744c0527e1faa9f8726e462a12a4feb06bd8801e751e4")
if err != nil {
fmt.Fprintf(os.Stderr, "hex decode failed: %v\n", err)
os.Exit(1)
}
shake := sha3.NewShake256()
if _, err := shake.Write([]byte("abc")); err != nil {
fmt.Fprintf(os.Stderr, "shake.Write failed: %v\n", err)
os.Exit(1)
}
buf := make([]byte, 64)
if _, err := io.ReadFull(shake, buf); err != nil {
fmt.Fprintf(os.Stderr, "shake ReadFull failed: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(buf, expectedShakeAbc) {
fmt.Fprintf(os.Stderr, "SHAKE256 test vector mismatch: got %x, want %x\n", buf, expectedShakeAbc)
os.Exit(1)
}
// 2. golang.org/x/crypto/sha3.NewShake256 produces deterministic output for identical input and distinct output for different input
shakeA := sha3.NewShake256()
shakeA.Write([]byte("deterministic input test"))
outA := make([]byte, 48)
if _, err := io.ReadFull(shakeA, outA); err != nil {
fmt.Fprintf(os.Stderr, "shakeA ReadFull failed: %v\n", err)
os.Exit(1)
}
shakeB := sha3.NewShake256()
shakeB.Write([]byte("deterministic input test"))
outB := make([]byte, 48)
if _, err := io.ReadFull(shakeB, outB); err != nil {
fmt.Fprintf(os.Stderr, "shakeB ReadFull failed: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(outA, outB) {
fmt.Fprintf(os.Stderr, "deterministic assertion failed: outputs differ for identical input\n")
os.Exit(1)
}
shakeC := sha3.NewShake256()
shakeC.Write([]byte("different input test"))
outC := make([]byte, 48)
if _, err := io.ReadFull(shakeC, outC); err != nil {
fmt.Fprintf(os.Stderr, "shakeC ReadFull failed: %v\n", err)
os.Exit(1)
}
if bytes.Equal(outA, outC) {
fmt.Fprintf(os.Stderr, "collision: distinct inputs produced identical output\n")
os.Exit(1)
}
// 3. golang.org/x/crypto/sha3.NewShake256 Clone produces identical output stream from cloned state
shakeOriginal := sha3.NewShake256()
shakeOriginal.Write([]byte("shared state data"))
prefix := make([]byte, 20)
if _, err := io.ReadFull(shakeOriginal, prefix); err != nil {
fmt.Fprintf(os.Stderr, "shakeOriginal ReadFull prefix failed: %v\n", err)
os.Exit(1)
}
shakeClone := shakeOriginal.Clone()
nextOriginal := make([]byte, 40)
if _, err := io.ReadFull(shakeOriginal, nextOriginal); err != nil {
fmt.Fprintf(os.Stderr, "shakeOriginal ReadFull suffix failed: %v\n", err)
os.Exit(1)
}
nextClone := make([]byte, 40)
if _, err := io.ReadFull(shakeClone, nextClone); err != nil {
fmt.Fprintf(os.Stderr, "shakeClone ReadFull suffix failed: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(nextOriginal, nextClone) {
fmt.Fprintf(os.Stderr, "Clone assertion failed: cloned stream differed from original\n")
os.Exit(1)
}
// 4. golang.org/x/crypto/sha3.NewShake256 Reset restarts stream from initial state
shakeReset := sha3.NewShake256()
shakeReset.Write([]byte("some random data"))
discard := make([]byte, 128)
if _, err := io.ReadFull(shakeReset, discard); err != nil {
fmt.Fprintf(os.Stderr, "shakeReset ReadFull discard failed: %v\n", err)
os.Exit(1)
}
shakeReset.Reset()
shakeReset.Write([]byte("abc"))
resetOut := make([]byte, 64)
if _, err := io.ReadFull(shakeReset, resetOut); err != nil {
fmt.Fprintf(os.Stderr, "shakeReset ReadFull after reset failed: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(resetOut, expectedShakeAbc) {
fmt.Fprintf(os.Stderr, "Reset assertion failed: output after reset did not match initial test vector\n")
os.Exit(1)
}
fmt.Println("All contract assertions passed.")
}
Origin Seeder
anonymous