nx_nxa_secdump.nx
buildroot/runtime/nx_nxa_secdump.nx
about
nx_nxa_secdump.nx -- THE MISSING NXA INSPECTOR: print the section directory of an NXA asset,
verify every section against the checksum the format already carries, reconcile the byte
partition, and on request print the leading words of any one section.
WHY THIS EXISTS (measured 2026-09-01, lane=consumer-gap). The estate holds a WRITER for every
NXA section (nx_nxa_texc, nx_nxa_texm, nx_nxa_dyna, nx_nxa_morf, nx_nxa_skin, nx_garment_gen)
and a floor gate that prints tag:wordcount -- and NOTHING that can answer "are these two
assets the same bytes in the sections they share?" or "how many map records does the SHIPPED
TEXM carry, and how long is each?". nx_capsearch over 7,175 organs, corpus_complete=1, returns
no inspector. The consequence was concrete: a 40 MB superset claim had to be argued from
declared word counts alone, because nx_contentdiff CAPS BOTH SIDES AT 4,194,304 BYTES and
therefore cannot adjudicate any asset larger than 4 MiB at all.
THE OBSERVATION THIS ORGAN MONETISES: the NXA directory ALREADY CARRIES a per-section
order-sensitive rolling checksum over that section's words. Byte-identity of a section between
two assets is therefore a FREE, FORMAT-NATIVE comparison. Equal tag + equal wordlen + equal
check is a weak-but-native identity claim, and it is stated as exactly that rather than
dressed up as a cryptographic hash.
COMPOSES, NEVER RE-IMPLEMENTS: nxa_check2 comes from nx_nxa.nx, the ONE definition of the
format checksum, so this verifier cannot drift from the writers.
nx_nxa_secdump <asset.nxa> -- directory + per-section verify + reconciliation
nx_nxa_secdump <asset.nxa> <TAG> [nwords] -- the same, plus the first nwords words of <TAG>
EXITS: 0 OK (every section checksum recomputed and matched)
1 I/O -- asset unreadable
2 usage (including a non-numeric nwords, which REFUSES rather than defaulting)
3 bad container (magic, version, section count, or a directory past EOF)
4 named TAG not present in the directory
5 at least one section FAILED verification (corrupt, hand-edited, or out of file)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_nxa.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
| 37 | const SD_OK: i64 = 0 |
| 38 | const SD_E_IO: i64 = 1 |
| 39 | const SD_E_USAGE: i64 = 2 |
| 40 | const SD_E_BAD: i64 = 3 |
| 41 | const SD_E_NOTAG: i64 = 4 |
| 42 | const SD_E_CKSUM: i64 = 5 |
| 45 | const SD_HDR_BYTES: i64 = 32 |
| 46 | const SD_DIRENT_BYTES: i64 = 32 |
| 47 | const SD_DIRENT_WORDS: i64 = 4 |
| 48 | const SD_WORD: i64 = 8 |
| 49 | const SD_TAG_CHARS: i64 = 4 |
| 50 | const SD_OFF_VER: i64 = 8 |
| 51 | const SD_OFF_NSEC: i64 = 16 |
| 52 | const SD_OFF_TOCCK: i64 = 24 |
| 53 | const SD_DIR_OFF: i64 = 8 |
| 54 | const SD_DIR_WLEN: i64 = 16 |
| 55 | const SD_DIR_CHECK: i64 = 24 |
| 56 | const SD_NSEC_MAX: i64 = 64 |
| 57 | const SD_MAGIC_CHARS: i64 = 8 |
| 58 | const SD_BYTE: i64 = 256 |
| 59 | const SD_BYTE_MASK: i64 = 255 |
| 60 | const SD_TOP_BYTE: i64 = 7 |
| 61 | const SD_ASCII_ZERO: i64 = 48 |
| 62 | const SD_DECIMAL: i64 = 10 |
| 63 | const SD_DIGIT_MAX: i64 = 9 |
| 64 | const SD_STDOUT: i64 = 1 |
| 65 | const SD_NUMBUF: i64 = 32 |
| 66 | const SD_CHECK_SEED: i64 = 1 |
| 67 | const SD_WORDS_DEFAULT: i64 = 24 |
| 68 | const SD_ARG_ASSET: i64 = 1 |
| 69 | const SD_ARG_TAG: i64 = 2 |
| 70 | const SD_ARG_NWORDS: i64 = 3 |
| 71 | const SD_ARGC_ASSET: i64 = 2 |
| 72 | const SD_ARGC_TAG: i64 = 3 |
| 73 | const SD_ARGC_NWORDS: i64 = 4 |
| 74 | const SD_TAGBUF: i64 = 8 |
| 75 | const SD_SCRATCH: i64 = 16 |
| 76 | const SD_MISS: i64 = 0 - 1 |
functions
| 78 | func sd_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: sd_out |
| 79 | func sd_out(s: *u8) -> i64 { sys_write(SD_STDOUT, s, sd_slen(s)); return 0 } |
| 80 | func sd_num(v: i64) -> i64 |
| 94 | func sd_rd64(b: *u8, off: i64) -> i64 called by 1: main |
| 102 | func sd_atoi(s: *u8) -> i64 called by 1: main |
| 118 | func sd_tag_eq(b: *u8, e: i64, t: *u8) -> i64 called by 1: main |
| 124 | func main(argc: i64, argv: *i64) -> i64 |