fits-checksum · shipping · also FITS CHECKSUM, FITS DATASUM

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.

Related Observatory article: Read on hesela.com

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

  1. Seaman, Pence and Rots: FITS Checksum Proposal, sections 2-3 (accessed 2026-10-18)
  2. Astropy v8.0.2: verify_datasum, verify_checksum and warning handling (accessed 2026-10-18)
  3. Astropy: FITS image scaling with BSCALE and BZERO (accessed 2026-10-18)
  4. CFITSIO C user's guide: File Checksum Routines and DATAOK/HDUOK (accessed 2026-10-18)
  5. FITS archive checks: reordered pixels can preserve both checksums (accessed 2026-10-18)
  6. Astropy v8.0.2 image.py: loaded-image checksum path (accessed 2026-10-18)
  7. Hesela: FITS write-back and independent-reader evidence, exact-value acceptance (accessed 2026-10-23)
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.

JSON: /data/terms/fits-checksum.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. FITS checksum convention. Hesela. 2026-10-23. https://hesela.dev/terms/fits-checksum/