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: FITS checksum convention on hesela.com

Coverage: DATASUM covers data records, including padding; CHECKSUM also covers the header. A data-only check does not cover BSCALE or BZERO. Both use an additive checksum, so exchanging complete aligned 32-bit words preserves the sum rather than proving their order. [1] [3]

API states: Astropy 8.0.2 verify_checksum and verify_datasum return 1 for success, 0 for mismatch and 2 for an absent keyword. Missing is therefore not safely handled by a truthiness test. CFITSIO DATAOK and HDUOK instead use 1, -1 and 0 for valid, mismatch and absent respectively; they are separate output verdicts from operational status. [2] [4]

Evidence: Hesela's nine controlled uncompressed-image cases include a detected data-bit flip, a padding-only fault, an undetected pixel swap, scaling changes and a missing extension. These demonstrate verification boundaries, not incident frequency or a newly discovered library defect. [5]

Read state: in the pinned Astropy experiment, a padding-only bit flip fails both checks before image data access, then passes both after the array is loaded with scaling disabled. Decoded pixels and the file's before/after hash stay unchanged. Verify on-disk records before loading or transforming data; the loaded-array path is a different coverage boundary. [6] [5]

Relations

related
fits, checksum, cryptographic-hash, 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)

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-18. https://hesela.dev/terms/fits-checksum/