code wiki / _hdl_build / _rt_addk.nx

_rt_addk.nx source

↩ module page · 8 lines · 787 B

1// _rt_addk.nx -- PROOF FIXTURE for pe16 GATE_HARNESS (NOT a deliverable organ; a reversible 2// inverse-pair so the scaffold can be proven end-to-end without coupling to a real codec's 3// signature). add-constant cipher mod 256: encode +90, decode +166 (= -90 mod 256) -> identity 4// round-trip; flipping any encoded byte changes the decode (tamper-detectable). No XOR (keeps to 5// the verified operator set). license_tier: ORIGINAL (test fixture) 6import "nx_syscalls.nx" 7func _rt_addk_encode(src: *u8, n: i64, dst: *u8) -> i64 { var i: i64 = 0; while i < n { dst[i] = (((src[i] & 255) + 90) & 255) as u8; i = i + 1 } return n } 8func _rt_addk_decode(enc: *u8, m: i64, out: *u8) -> i64 { var i: i64 = 0; while i < m { out[i] = (((enc[i] & 255) + 166) & 255) as u8; i = i + 1 } return m }