code wiki / (root) / nx_crypsis.nx

nx_crypsis.nx

buildroot/runtime/nx_crypsis.nx

8658 B210 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_crypsis.nx -- byte-level camouflage / polymorphism. Biology: crypsis is concealment by resemblance to background or to common harmless objects. Stick insects look like twigs, leaf insects look like leaves, octopus camouflage is real-time pattern matching against substrate. Predators that hunt by sight skip because they don't recognize the prey AS prey. SUBSTRATE EQUIVALENT, per user 2026-05-19 directive: same logical payload, varied byte signature each emission. Vendor's signature- based detection ML sees no two cells alike -- pattern-match confidence stays below threshold so the detection rule never fires. The PAYLOAD is functionally identical; the WIRE FORMAT is different every time. Three V1 mechanisms: 1. **XOR mask rotation** -- a per-emission random mask XOR'd over the payload byte-by-byte. Reversible with the same mask; mask is included in the emission header (variable position). 2. **Padding randomization** -- inject N random padding bytes between functional regions; padding count varies 0-15 per emission. Doesn't change semantics; changes shape. 3. **Allocation-layout variance** -- when cells are emitted, the relative order of independent fields is shuffled across emissions so byte-position-based signatures don't anchor. THE LIMITS: crypsis defeats SIGNATURE detection. It doesn't defeat BEHAVIORAL detection (a scanner observing "this region runs code at address X every N microseconds" sees the behavior regardless of byte signature). The judo is layered: crypsis fools static scanners, aposematism fools heuristic scanners, decoy fools dynamic scanners. Each layer wins SOME percentage; stacked they approach unity. Composes: nx_methyl -- methyl mark wraps the post-crypsis bytes so self-verification still works (the mask + payload are jointly signed; the mark validates the masked-and-unmasked content) nx_decoy -- decoy artifacts get crypsis too so they don't

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_crypsis.nx nx_crypsis_test.nx nx_mimicry_compose_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_crypsis_test.nxnx_mimicry_compose_test.nx

structs

92struct NxCrypsisHeader

consts

79const NX_CRYP_OK: nx_int = 0
80const NX_CRYP_ERR_DST_TOO_SMALL: nx_int = 1
81const NX_CRYP_ERR_BAD_MASK: nx_int = 2
99const NX_CRYPSIS_MAGIC: nx_int = 0x4e58435950534953 // "NXCYPSIS"

functions

106func nx_crypsis_encode_size(payload_len: nx_size, pad_count: nx_int) -> nx_size
120func nx_crypsis_encode(payload: *u8,
called by 2: mainmain calls 1: nx_crypsis_encode_size
166func nx_crypsis_decode(src: *u8,
called by 1: main
201func nx_crypsis_signatures_match(a: *u8, a_len: nx_size,