# NAND randomizer: executable source-helper evidence

This package accompanies [NAND data randomization](https://hesela.dev/terms/nand-data-randomization/) and the [copyback analysis](https://hesela.com/analyses/nand-copyback-ecc-boundary/#representation).
It executes five original Linux v6.12 helpers in a userspace C shim. It does not access a device.

## Results and scope

See [results.json](results.json) and [sources.json](sources.json).
The exact checks cover 98,304 state transitions, 256 OOB seeds, 42 address/marker configurations and eight constructed erased-buffer cases.
For 64 pages per block and 512-byte ECC steps, the two-byte software transform at page 0 followed by page 1 produces c67a from ffff; using page 0 or page 64 for the second transform restores ffff.
These are software pre/post-transform bytes, not physical bad-block marker values, a whole-page decoder or relocation permission.

A separate control supplies 24 data bytes with one zero bit and eight ECC bytes with eight zero bits.
At threshold four the complete input is rejected; omitting ECC accepts it and normalizes data to FF.
The buffers are constructed and are not claimed to be valid ECC codewords. Classification is not proof of a past erase operation.

## Replay

Download audit.py, test_audit.py, results.json and sources.json into one directory.
Python 3.10+ and a Linux C compiler with UBSan are required.

```sh
python3 -B audit.py --sources /tmp/hesela-nand-v612 --fetch --check results.json
NAND_SOURCE_DIR=/tmp/hesela-nand-v612 python3 -B -m unittest -v test_audit
NAND_SOURCE_DIR=/tmp/hesela-nand-v612 python3 -B -O -m unittest -v test_audit
```

The fetch obtains two immutable source files, verifies SHA-256 and rejects changed files.
Tests compile at O0 and O2 with undefined-behavior checks; temporary binaries are removed.
All 65,536 two-byte inputs roundtrip under each of two selected masks.
The publishing session independently reran the existing packet; this is not external scientific peer review.

The harness is GPL-2.0-only. Extracted sunxi code is GPL-2.0-or-later and NAND core code GPL-2.0-only.
Original notices are retained in the temporary compilation unit. No Linux-derived binary or manufacturer PDF is distributed.
The source ledger retains access dates, exact locators and rights.
