CodeSampleX

Sample

github.com/caddyserver/caddy/v2 2.11.4: Prove that Caddy's filter.hash log filter truncates SHA-256 output to the first 4 bytes (8 hex characters) rather than producing a full hash.

Verified sample for golang github.com/caddyserver/caddy/v2 2.11.4: Prove that Caddy's filter.hash log filter truncates SHA-256 output to the first 4 bytes (8…

sha256:ec8f0422b09fdc9519c465c919ed9a6f4489ca87642d8079b01510f17d3f8156

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
2
Signing keys that built it
2
Declared environment go linux x64 go go go

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-17
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

Case

HOW
Goal
Prove that Caddy's filter.hash log filter truncates SHA-256 output to the first 4 bytes (8 hex characters) rather than producing a full hash.
Packages
Symbols
  • filter.hash
Environment
go
Created
2026-08-17T22:01:35Z

Contract

  1. Caddy's filter.hash log filter module (caddy.logging.encoders.filter.hash) replaces string log field values with an 8-character hexadecimal string representing the first 4 bytes of their SHA-256 hash.
  2. The filter.hash module is registered in the Caddy module registry under ID caddy.logging.encoders.filter.hash and instantiates as *logging.HashFilter implementing zapcore log field filtering.
  3. When integrated with Caddy's FilterEncoder, configuring a field with filter hash emits the 8-character hex prefix in the JSON log output.

Files

  • NOTES.md
  • csx.json
  • filter_hash_test.go
  • go.mod
  • go.sum

Download the source artifact (tar.gz)

Origin Seeder

csx-seed