nx_filehash_gate.nx
buildroot/runtime/nx_filehash_gate.nx
about
nx_filehash_gate.nx -- THE GATE FOR THE IDENTITY RULER. Every content pin in every /compare .refs register on this
estate is a sha256 produced by nx_filehash, and every fetch-time provenance binding compares against one. On
2026-09-06 nx_catalog reported nx_filehash_gate ABSENT -- no source, no binary, nothing promoted -- so the ruler
that decides whether two artifacts are the same bytes had no gate of its own. This is that gate.
IT COMPOSES THE ORGAN'S OWN SELFTEST RATHER THAN RE-IMPLEMENTING IT (T8), because a second copy of the same five
teeth would be the duplicate-ruler defect. What a GATE adds over a selftest is threefold and none of it is
duplication: it forks the DEPLOYED ARTIFACT from outside rather than testing itself from within, it can be
BITE-PROVEN by mutating the subject, and it is rostered so it runs on a beat instead of when a seat types it.
THE INDEPENDENT VECTORS ARE THE POINT. T1 and T2 are published SHA-256 known answers this gate carries itself:
"abc" and THE EMPTY INPUT. The empty case is the one an organ's own selftest most often omits and the one a
length-driven bug survives, so it is here deliberately. If the organ and this gate ever disagree, the published
vector wins -- that is what an external ruler is for.
NEGATIVE CONTROLS, because a checker that returned success for everything would score 100 percent: T7 requires a
MISSING file to yield NO digest at all, and T6 requires two DIFFERENT files to compare unequal. A gate whose every
tooth asserts presence cannot tell a working ruler from one that prints a constant.
Fixtures are assembled at RUNTIME under /tmp/nx_filehash_gate/ so this gate never shares scratch with a production
beat, and T0 asserts the fixtures actually reached their intended bytes BEFORE any outcome is read off them.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 26 | const FHG_DIR: *u8 = "/tmp/nx_filehash_gate" |
| 27 | const FHG_ABC: *u8 = "/tmp/nx_filehash_gate/abc.txt" |
| 28 | const FHG_ABC2: *u8 = "/tmp/nx_filehash_gate/abc2.txt" |
| 29 | const FHG_ABD: *u8 = "/tmp/nx_filehash_gate/abd.txt" |
| 30 | const FHG_EMPTY: *u8 = "/tmp/nx_filehash_gate/empty.txt" |
| 31 | const FHG_MISSING: *u8 = "/tmp/nx_filehash_gate/no_such_file.txt" |
| 32 | const FHG_ELF: *u8 = "nx_filehash.elf" |
| 33 | const FHG_DIRMODE: i64 = 0x1ed |
| 34 | const FHG_FILEMODE: i64 = 0x1a4 |
| 35 | const FHG_CAP: i64 = 16384 |
| 36 | const FHG_I64: i64 = 8 |
| 42 | const FHG_ARGV_SLOTS: i64 = 64 |
| 43 | const FHG_ABC_LEN: i64 = 3 |
| 45 | const FHG_KAT_ABC: *u8 = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" |
| 46 | const FHG_KAT_EMPTY: *u8 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
functions
| 48 | func fhg_write(path: *u8, data: *u8, n: i64) -> i64 |
| 58 | func fhg_run1(a1: *u8, out: *u8, olen: *i64) -> i64 |
| 68 | func fhg_run3(a1: *u8, a2: *u8, a3: *u8, out: *u8, olen: *i64) -> i64 |
| 79 | func main(argc: i64, argv: *i64) -> i64 |