Documentation
¶
Overview ¶
Package hashing defines the Hasher port and the raw/normalized content-hash helpers Båge uses for drift discipline (SPEC §4.3). RawHash gates byte-offset validity against the live file; NormHash classifies whitespace-only drift.
XXHasher (xxhash.go) is the canonical adapter, matching Hylla's content hash; FNVHasher is a dependency-free fallback. The two-hash semantics are engine-independent, so the drift logic is unaffected by which Hasher is used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FNVHasher ¶
type FNVHasher struct{}
FNVHasher is the stdlib adapter implementing Hasher with FNV-1a (64-bit), hex-encoded. It is dependency-free and holds no state, so the zero value is ready to use. It is the fallback Hasher; XXHasher is the canonical one shared with Hylla.
type Hasher ¶
type Hasher interface {
// Sum returns the lowercase hex-encoded digest of b.
Sum(b []byte) string
}
Hasher computes a stable hex digest of a byte slice. Implementations must be deterministic and free of hidden state so equal inputs always yield equal digests.
type XXHasher ¶
type XXHasher struct{}
XXHasher implements Hasher with xxHash64 — the canonical content hash shared with Hylla. The digest is the 16-character, zero-padded, lowercase hex of the 64-bit sum, so Båge and Hylla produce byte-identical digests for identical inputs. This fixed format IS the cross-system contract: any change to the width or encoding here must be mirrored on the Hylla side.
XXHasher holds no state, so the zero value is ready to use.