code wiki / _hdl_build / nx_filehash.nx

nx_filehash.nx

buildroot/runtime/_hdl_build/nx_filehash.nx

8955 B185 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_filehash.nx -- SHA-256 OF A FILE, AND THE ONE-CALL "ARE THESE TWO ARTIFACTS THE SAME BYTES" TEST. ★WHY THIS EXISTS, and it is a gap the ecosystem's own laws made expensive. This codebase carries a standing rule -- VERIFY THE INSTRUMENT AND THE ARTIFACT -- and a banked correction where a session claimed two meshes were "byte-identical", was wrong, and recorded the reason: "I inferred byte-identity from a matching tri count and matching bench scores and NEVER HASHED THE FILES." The reason nobody hashed the files is that there was no way to: nx_sha256 exists as a LIBRARY with a dozen gates and wasm builds, and `sha256_digest(bytes,n,out)` has been sitting in it the whole time, but NO ORGAN exposed it over a PATH. So every "byte-identical" claim in this program has been rhetorical. ★This is the adoption gap in its purest form: the primitive was built, gated and never wired to the one caller shape that every other lane needs. It is 90 lines. nx_filehash <path> -> {"sha256":"<64 hex>","bytes":N} nx_filehash cmp <a> <b> -> {"identical":0|1, both digests, both sizes} nx_filehash selftest -> KAT + non-vacuity teeth license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_sha256.nx nx_filehash.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_sha256.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main fh_puts sys_write fh_streq fh_selftest sys_mmap sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ fh_hex_into fh_streq ↻ fh_puts ↻ fh_pn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap fh_hash_file sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sha256_digest ↻

structs

none

consts

22const FH_DIGEST_BYTES: i64 = 32
23const FH_LENSLOT: i64 = 16
100const FH_KAT: *u8 = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" as *u8

functions

25func fh_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
30func fh_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 3: fh_onefh_cmpfh_selftest calls 1: nxi_out
31func fh_streq(a: *u8, b: *u8) -> i64
called by 2: fh_selftestmain
37func fh_hex(d: *u8) -> i64
called by 2: fh_onefh_cmp calls 2: sys_mmapsys_write
54func fh_hash_file(path: *u8, out: *u8) -> i64
63func fh_one(path: *u8) -> i64
77func fh_cmp(pa: *u8, pb: *u8) -> i64
101func fh_hex_into(d: *u8, out: *u8) -> i64
called by 1: fh_selftest
114func fh_selftest() -> i64
177func main(argc: i64, argv: *i64) -> i64