Beispiel
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
Verifiziertes Beispiel für golang golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und…
sha256:b0b48255fe46e16ccfa39e125e66d528fb9c1649312d9f76ce74a4ffc76e1608
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-10-22 |
Fall
HOW- Ziel
- verify pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a
- Erstellt
- 2026-10-22T18:41:20Z
Contract
- bcrypt.GenerateFromPassword produces a non-empty hash at bcrypt.MinCost
- bcrypt.Cost extracts the configured cost from the generated hash
- bcrypt.CompareHashAndPassword returns nil when the password matches the hash
- bcrypt.CompareHashAndPassword returns bcrypt.ErrMismatchedHashAndPassword when password differs
- bcrypt.GenerateFromPassword returns bcrypt.InvalidCostError when cost exceeds bcrypt.MaxCost
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Quelltext
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:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a
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:d89135048737f62223de4423d09aa1229c2dec3f0294c56838703d991245b87d","contract":["bcrypt.GenerateFromPassword produces a non-empty hash at bcrypt.MinCost","bcrypt.Cost extracts the configured cost from the generated hash","bcrypt.CompareHashAndPassword returns nil when the password matches the hash","bcrypt.CompareHashAndPassword returns bcrypt.ErrMismatchedHashAndPassword when password differs","bcrypt.GenerateFromPassword returns bcrypt.InvalidCostError when cost exceeds bcrypt.MaxCost"],"goal":"verify pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a","kind":"HOW","packages":["pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a"],"schemaVersion":1},"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.0.0-20190313024323-a1f597ede03a"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a","verifierAdapter":"golang@1"}
module example.com/sample
go 1.20
require golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
package main
import (
"fmt"
"log"
"golang.org/x/crypto/bcrypt"
)
func main() {
secret := []byte("sample-passphrase")
hashed, err := bcrypt.GenerateFromPassword(secret, bcrypt.MinCost)
if err != nil {
log.Fatalf("GenerateFromPassword failed: %v", err)
}
cost, err := bcrypt.Cost(hashed)
if err != nil {
log.Fatalf("Cost failed: %v", err)
}
if err := bcrypt.CompareHashAndPassword(hashed, secret); err != nil {
log.Fatalf("CompareHashAndPassword failed: %v", err)
}
fmt.Printf("verified cost=%d\n", cost)
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/crypto@v0.0.0-20190313024323-a1f597ede03a"
]
}
package main
import (
"errors"
"fmt"
"os"
"golang.org/x/crypto/bcrypt"
)
func main() {
password := []byte("correct-passphrase")
wrongPassword := []byte("wrong-passphrase")
// 1. bcrypt.GenerateFromPassword produces a non-empty hash at bcrypt.MinCost
hashed, err := bcrypt.GenerateFromPassword(password, bcrypt.MinCost)
if err != nil || len(hashed) == 0 {
fmt.Fprintf(os.Stderr, "GenerateFromPassword failed: len=%d err=%v\n", len(hashed), err)
os.Exit(1)
}
// 2. bcrypt.Cost extracts the configured cost from the generated hash
cost, err := bcrypt.Cost(hashed)
if err != nil || cost != bcrypt.MinCost {
fmt.Fprintf(os.Stderr, "expected cost %d, got %d (err=%v)\n", bcrypt.MinCost, cost, err)
os.Exit(1)
}
// 3. bcrypt.CompareHashAndPassword returns nil when the password matches the hash
if err := bcrypt.CompareHashAndPassword(hashed, password); err != nil {
fmt.Fprintf(os.Stderr, "expected nil for matching password, got %v\n", err)
os.Exit(1)
}
// 4. bcrypt.CompareHashAndPassword returns bcrypt.ErrMismatchedHashAndPassword when password differs
if err := bcrypt.CompareHashAndPassword(hashed, wrongPassword); !errors.Is(err, bcrypt.ErrMismatchedHashAndPassword) {
fmt.Fprintf(os.Stderr, "expected ErrMismatchedHashAndPassword, got %v\n", err)
os.Exit(1)
}
// 5. bcrypt.GenerateFromPassword returns bcrypt.InvalidCostError when cost exceeds bcrypt.MaxCost
if _, err := bcrypt.GenerateFromPassword(password, bcrypt.MaxCost+1); err != bcrypt.InvalidCostError(bcrypt.MaxCost+1) {
fmt.Fprintf(os.Stderr, "expected InvalidCostError(%d), got %v\n", bcrypt.MaxCost+1, err)
os.Exit(1)
}
fmt.Println("contract ok")
}
Ursprungs-Seeder
anonym