fnv.nx
buildroot/runtime/_attic/fnv.nx
about
RETIRED 2026-07-30 -- moved here from runtime/fnv.nx. PRESERVED VERBATIM BELOW, NOT DELETED (rule 13).
WHY IT WAS RETIRED: it defined `fnv1a`, `fnv1a_init`, `fnv1a_update` and `fnv1a_cstr` -- THE EXACT FOUR
SYMBOLS the canonical runtime/nx_fnv.nx defines -- with a byte-identical algorithm and identical
constants. The ONLY difference was `import "syscalls.nx"` vs `import "nx_syscalls.nx"`.
TWO FILES CLAIMING TO BE THE CANONICAL HASH IS WORSE THAN NONE: nx_fnv.nx's own header carries the
cardinal law "All other primitives needing FNV-1a MUST import nx_fnv.nx ... never re-implement a hash
inline" -- but that law names a target that was AMBIGUOUS, and any organ importing both would collide
symbol-for-symbol.
MEASURED BEFORE RETIRING (complete scan of buildroot, not a partial one):
runtime/fnv.nx 2577 B -- 0 importers
runtime/nx_fnv.nx 3067 B -- 7 importers <- canonical, keeps the name the law points at
A sovereign nx_shelltool scan returned 0 matches too, but reported PARTIAL (budget-exceeded at 15315 of
~19940 files) -- and ZERO ON A PARTIAL SCAN IS NOT PROOF OF ABSENCE, so the count above is from a
complete scan. The tool was right to say so; the reading would have been wrong to trust.
TO RESURRECT: copy this file back to runtime/fnv.nx and change the import to nx_syscalls.nx -- but do
not, because nx_fnv.nx already is this, and re-adding it re-creates the ambiguity.
license_tier: ORIGINAL No hw writes (Rule 26).
---------------- ORIGINAL CONTENT, VERBATIM ----------------
fnv.nx -- FNV-1a non-cryptographic hash (Fowler-Noll-Vo).
64-bit FNV-1a. Used for: hash table keying, file
fingerprinting, Bloom filter mixing, deduplication. NOT for
security -- an attacker who controls input can construct
collisions. For cryptographic hashing use sha256 / sha512 /
sha3.
Algorithm (Fowler-Noll-Vo 1991; rfc draft-eastlake-fnv):
hash = FNV_OFFSET_BASIS
for each byte b in input:
hash = hash XOR b
hash = hash * FNV_PRIME
FNV-1a (xor-then-multiply) has better avalanche than plain
FNV-1 (multiply-then-xor) so we implement 1a.
dependencies 0 imports · 0 importers
imports: none
imported by: nobody (leaf or entry point)
structs
| none |
consts
| none |
functions
| none |