# NPY and NPZ: bytes, interpretation and read coverage

NumPy 2.5.4 / CPython 3.12.3, Linux x86-64, little-endian.
Eight NPY fixtures, three NPZ fixtures and one dtype-metadata round trip.
Two retained captures agree exactly. These are designed in-memory controls, not
independent statistical trials, a hardware benchmark or a security audit.

## Main result

Changing only the storage-order header preserves all 24 numeric payload bytes,
shape 2 by 3, int32 dtype and sum 21, but changes coordinate assignment from
[[1,2,3],[4,5,6]] to [[1,3,5],[2,4,6]]. The full-file reference digest changes.
A payload-only match is not a hash collision or a NumPy defect.

NPZ selected access can leave another member's CRC damage undiscovered.
Repackaging an altered header creates valid CRCs for the new bytes, not evidence
of intended coordinates. A warning-bearing dtype-metadata write omits the
application's unit before the representation is hashed.

## Reproduce

Use a Python environment matching requirements.txt. From the extracted directory:

```sh
python -B -m unittest -v test_probe.py test_outputs.py
python -O -B -m unittest -v test_probe.py test_outputs.py
python -B probe.py --output ../npy-replay.json --compare capture-1.json
python -B build_outputs.py --check
sha256sum -c SHA256SUMS
```

The replay output must be outside this directory and must not already exist.
The probe uses BytesIO, never writes a device, and sets allow_pickle=False.
Tests perform a fresh native replay and compare against literal expected arrays.
An optimized Python run is another execution of the same implementation, not
independent software confirmation.

## Evidence and scope

summary.json and results-table.md derive from the two complete capture files.
Sources and installed-module fingerprints accompany the runner. The archive
contains all code and inputs required for these commands; it does not bundle
NumPy or any third-party paper/source. The SHA256SUMS manifest checks extracted
files, not itself or this enclosing ZIP, and is not an authenticity signature.
A successful checksum command checks its listed inputs, not whether the expected
inventory was listed. The publisher separately requires the complete reviewed
source inventory, rejects duplicate entries, and packages the exact bytes it
verified. Retaining a trusted release identity is still necessary.

The raw-payload digest covers everything after the first NPY header. For the
two-record stream this includes the second record. Hashing a decoded array in a
declared canonical order is different. A successful first load need not consume
all records: the application must choose a one-record or sequence contract.

Excluded: real-file/mmap behavior, NPY 2/3, object/custom/structured dtypes,
compressed NPZ members, duplicate archive names, hostile-input certification,
concurrent writes, crash durability and physical failure frequencies.
The expected identity, schema and digest must be independently trustworthy.

Interpretation: protect the complete representation, preserve required units and
axes explicitly, read each required member, and check decoded semantics against
the intended schema. A hash cannot recover information omitted before hashing.
See the accompanying analysis for the separate historical end-to-end design
argument; these observations do not replicate that paper's systems.
