Пример
github.com/cespare/xxhash/v2 v2.1.1: Sum64String
Проверенный пример — golang github.com/cespare/xxhash/v2 v2.1.1: Sum64String. Контракт выполнен на go 1.26 · linux alpine/x64 · docker и пройден.
sha256:c2fd8fc07474fb7456abf494eb824830fd8ec05d66bfade9c0fd230c9620acc7
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 2
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux 24 · ubuntu · glibc 2.39 x64 go
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-26 |
| 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-07 |
Кейс
HOW- Цель
- verify Sum64String in pkg:golang/github.com/cespare/xxhash/v2@v2.1.1
- Символы
-
- Sum64String
- Создан
- 2026-08-26T01:16:18Z
Контракт
- xxhash.Sum64String computes the 64-bit xxHash checksum of a string matching xxhash.Sum64 of the equivalent byte slice
- xxhash.Sum64String produces deterministic non-zero checksum for non-empty string and distinct hashes for distinct string inputs
- xxhash.Sum64String correctly computes the hash of an empty string
Файлы
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Исходный код
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 Sum64String in pkg:golang/github.com/cespare/xxhash/v2@v2.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/cespare/xxhash/v2@v2.1.1
Demonstrate these symbols/APIs:
- Sum64String
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:0bd935df081559214d3814e4fa32c77a5f85b9cc33309f8862dcfbd6cb829cb0","contract":["xxhash.Sum64String computes the 64-bit xxHash checksum of a string matching xxhash.Sum64 of the equivalent byte slice","xxhash.Sum64String produces deterministic non-zero checksum for non-empty string and distinct hashes for distinct string inputs","xxhash.Sum64String correctly computes the hash of an empty string"],"goal":"verify Sum64String in pkg:golang/github.com/cespare/xxhash/v2@v2.1.1","kind":"HOW","packages":["pkg:golang/github.com/cespare/xxhash/v2@v2.1.1"],"schemaVersion":1,"symbols":["Sum64String"]},"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/github.com/cespare/xxhash/v2@v2.1.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/cespare/xxhash/v2@v2.1.1","symbols":["Sum64String"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require github.com/cespare/xxhash/v2 v2.1.1
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
package main
import (
"fmt"
"github.com/cespare/xxhash/v2"
)
func main() {
input := "hello world"
hashString := xxhash.Sum64String(input)
hashBytes := xxhash.Sum64([]byte(input))
fmt.Printf("xxhash.Sum64String(%q) = %016x\n", input, hashString)
fmt.Printf("xxhash.Sum64([]byte(%q)) = %016x\n", input, hashBytes)
fmt.Printf("Equal: %t\n", hashString == hashBytes)
}
{
"schemaVersion": 1,
"goal": "verify Sum64String in pkg:golang/github.com/cespare/xxhash/v2@v2.1.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/cespare/xxhash/v2@v2.1.1"
],
"symbols": [
"Sum64String"
]
}
package main
import (
"fmt"
"os"
"github.com/cespare/xxhash/v2"
)
func main() {
// Assertion 1: xxhash.Sum64String computes the 64-bit xxHash checksum of a string matching xxhash.Sum64 of the equivalent byte slice
testStrings := []string{
"",
"a",
"hello world",
"The quick brown fox jumps over the lazy dog",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
}
for _, s := range testStrings {
hStr := xxhash.Sum64String(s)
hBytes := xxhash.Sum64([]byte(s))
if hStr != hBytes {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String(%q) = %d != Sum64([]byte) = %d\n", s, hStr, hBytes)
os.Exit(1)
}
}
// Assertion 2: xxhash.Sum64String produces deterministic non-zero checksum for non-empty string and distinct hashes for distinct string inputs
h1 := xxhash.Sum64String("test-input-1")
h1Repeat := xxhash.Sum64String("test-input-1")
h2 := xxhash.Sum64String("test-input-2")
if h1 == 0 {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String produced unexpected zero hash for non-empty string\n")
os.Exit(1)
}
if h1 != h1Repeat {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String is not deterministic: %d != %d\n", h1, h1Repeat)
os.Exit(1)
}
if h1 == h2 {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String collision for distinct inputs %d == %d\n", h1, h2)
os.Exit(1)
}
// Assertion 3: xxhash.Sum64String correctly computes the hash of an empty string
hEmpty := xxhash.Sum64String("")
hEmptyBytes := xxhash.Sum64([]byte{})
if hEmpty != hEmptyBytes {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String(\"\") = %d != Sum64([]byte{}) = %d\n", hEmpty, hEmptyBytes)
os.Exit(1)
}
if hEmpty != 17241709254077376921 {
fmt.Fprintf(os.Stderr, "FAIL: Sum64String(\"\") expected 17241709254077376921, got %d\n", hEmpty)
os.Exit(1)
}
}
Исходный сидер
аноним