code wiki / (root) / nx_zip_gate.nx

nx_zip_gate.nx

buildroot/runtime/nx_zip_gate.nx

7195 B172 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic zip
docsdependenciesstructsconstsfunctions

about

nx_zip_gate.nx -- proves the ZIP writer/reader pair by ROUND-TRIP. T1 pins the CRC ALGORITHM to the classic check value 0xCBF43926 for "123456789". This matters more than usual here: nx_ogg.nx also implements something called "CRC-32", using the SAME polynomial UNreflected with zero init. The two are not interchangeable, and swapping them produces archives that round-trip perfectly against themselves while every unzip on earth reports a checksum error. Only an absolute known-value assertion separates them. T5 pins the central-directory offset. Readers trust the CD, not the local headers -- an archive with correct local headers and wrong CD offsets opens as empty or corrupt, and nothing in the local headers hints at it. The test resolves each entry's data THROUGH the CD offset and verifies the CRC of what it finds there. NON-VACUITY: T7 covers refusals -- a corrupted data byte must fail CRC, a short buffer must refuse, and a missing EOCD must not be invented. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_zip.nx nx_zip_gate.nx

imports: nx_syscalls.nxnx_zip.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap nxzip_crc32 nxzip_w16 nxzip_r16 nxzip_w32 nxzip_r32 nxzip_add_stored nxzip_strlen nxzip_crc32 ↻ nxzip_w32 ↻ nxzip_w16 ↻ nxzip_finalize nxzip_w32 ↻ nxzip_w16 ↻ nxzip_count nxzip_find_eocd nxzip_r32 ↻ nxzip_r16 ↻ nxzip_cd_start nxzip_find_eocd ↻ nxzip_r32 ↻ nxzip_read_cd nxzip_r32 ↻ nxzip_r16 ↻ nxzip_entry_data nxzip_r32 ↻ nxzip_r16 ↻ nxzip_crc32 ↻ nxzip_find_eocd ↻ g_puts sys_write sys_exit g_putn sys_mmap ↻ sys_write ↻

structs

none

consts

none

functions

24func g_puts(s: *u8) -> i64
called by 1: main calls 1: sys_write
31func g_putn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
44func main() -> i64