nx_crypsis.nx
buildroot/runtime/nx_crypsis.nx
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
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_crypsis_test.nxnx_mimicry_compose_test.nx
structs
| 92 | struct NxCrypsisHeader |
consts
| 79 | const NX_CRYP_OK: nx_int = 0 |
| 80 | const NX_CRYP_ERR_DST_TOO_SMALL: nx_int = 1 |
| 81 | const NX_CRYP_ERR_BAD_MASK: nx_int = 2 |
| 99 | const NX_CRYPSIS_MAGIC: nx_int = 0x4e58435950534953 // "NXCYPSIS" |
functions
| 106 | func nx_crypsis_encode_size(payload_len: nx_size, pad_count: nx_int) -> nx_size |
| 120 | func nx_crypsis_encode(payload: *u8, |
| 166 | func nx_crypsis_decode(src: *u8, called by 1: main |
| 201 | func nx_crypsis_signatures_match(a: *u8, a_len: nx_size, |