Documentation
¶
Overview ¶
Package normalize provides the shared content-normalization rule used to compute Båge's normalized content hash. The rule is byte-identical with Hylla's so the two systems agree on whitespace-only drift classification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize applies Båge's canonical content-normalization rule and returns a newly allocated slice; the input is never mutated. The rule, in order:
- normalize line endings to LF by dropping every carriage return (\r);
- strip trailing horizontal whitespace ([ \t\r]) immediately before each LF and at end-of-input;
- strip ALL consecutive leading UTF-8 BOMs (0xEF 0xBB 0xBF) — LAST.
It is a pure function with no I/O. Interior whitespace (including tabs) is preserved byte-for-byte. The ORDER is load-bearing for idempotency (and region_hash stability across systems): BOM stripping runs last, on the CR-free output, so a \r embedded in a BOM byte run cannot re-form a leading BOM after the strip; and ALL leading BOMs are stripped, not just one. Both are fuzz-discovered invariants (FuzzNormalizeIdempotent) — Hylla MUST match.
Types ¶
This section is empty.