From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:NumPy NPY and NPZ" |
|---|
| claim | "The header length field after the 8-byte magic is little-endian uint16 in version 1.0 and uint32 in versions 2.0 and 3.0; the text is latin1 in 1.0 and 2.0 and utf8 in 3.0; the data starts at a multiple of 64." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:NumPy NPY and NPZ" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "npy_prefix" |
|---|
| size_min | "0xA" |
|---|
| size_max | "0xC" |
|---|
| endianness | "little" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 6 |
|---|
| type | "char[6]" |
|---|
| name | "magic" |
|---|
|
| offset | "0x6" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "major" |
|---|
|
| offset | "0x7" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "minor" |
|---|
|
| offset | "0x8" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "header_len" |
|---|
| condition | "version 1.0" |
|---|
|
| offset | "0x8" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "header_len" |
|---|
| condition | "version 2.0 or 3.0" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "_header_size_info maps (1,0)->('<H','latin1'), (2,0)->('<I','latin1'), (3,0)->('<I','utf8'); _wrap_header pads so (MAGIC_LEN + fieldsize + hlen) % ARRAY_ALIGN == 0 with ARRAY_ALIGN 64" |
|---|
| repo | "numpy/numpy" |
|---|
| commit | "3e225b263fd62b68f657b2ad4522932618247aa8" |
|---|
| path | "numpy/lib/_format_impl.py" |
|---|
| lines | "188-191, 404-407" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "NPY header length field by version" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T04:01:30.766Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:44:12.563Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read numpy/lib/_format_impl.py at the cited commit: _header_size_info maps (1,0)->('<H','latin1'), (2,0)->('<I','latin1'), (3,0)->('<I','utf8'); _wrap_header pads so magic+field+header is a multiple of ARRAY_ALIGN. Prefix sizes 10 and 12 match size_min/size_max." |
|---|
|
|
|---|