FITS checksum convention
The FITS checksum convention embeds 32-bit one's-complement checks for an HDU's data records and its complete header/data unit in DATASUM and CHECKSUM header keywords.
DATASUM covers padded data records; CHECKSUM also covers the header. A data-only check excludes BSCALE and BZERO. Exchanging complete aligned 32-bit words preserves the additive sum, so it cannot establish their order. [1] [3]
Astropy 8.0.2 verification returns 1 for valid, 0 for mismatch and 2 for absent. CFITSIO DATAOK/HDUOK instead use 1, -1 and 0, separately from operational status. Test exact verdicts, not truthiness. [2] [4]
The original nine image cases cover pixel swaps, bit flips, scaling and missing HDUs. In the padding-damage case, Astropy 8.0.2 reports mismatches before array access but valid sums afterward; pixels and file bytes are unchanged. The loaded array excludes the damaged padding. CFITSIO 4.7.0 retains the mismatch in a separate native control. [6] [5] [7]
Checksums regenerated after a transformation can validate changed values. In twenty synthetic images across eight Astropy 8.0.2 workflows, thirty successful outputs change exact values or null masks while all inspected HDUs pass. Four separate operation failures remain failures. Independent CFITSIO reads confirm the output interpretation, but double comparisons hide changes in four configurations. Counts are selected examples, not incident frequencies; preserve exact values and separate null masks. [7]
Relations
- related
- Flexible Image Transport System (FITS), Checksum, Cryptographic hash function, Hash collision
Citations
- Seaman, Pence and Rots: FITS Checksum Proposal, sections 2-3
- Astropy v8.0.2: verify_datasum, verify_checksum and warning handling
- Astropy: FITS image scaling with BSCALE and BZERO
- CFITSIO C user's guide: File Checksum Routines and DATAOK/HDUOK
- FITS archive checks: reordered pixels can preserve both checksums
- Astropy v8.0.2 image.py: loaded-image checksum path
- Hesela: FITS write-back and independent-reader evidence, exact-value acceptance
Sources & caveats
- The acceptance supplement tests Astropy 8.0.2 / NumPy 2.3.4 output with CFITSIO 4.7.0. It excludes the merged upstream BLANK fix, compressed HDUs, tables, non-unit input scales and physical-media reliability.