{
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-18",
  "advantages": [],
  "limitations": [],
  "slug": "fits-checksum",
  "term": "FITS checksum convention",
  "aliases": [
    "FITS CHECKSUM",
    "FITS DATASUM"
  ],
  "definition": "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.",
  "note": "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. [proposal] [scaling]\n\nAPI 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. [astropy-code] [cfitsio]\n\nEvidence: 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. [hesela-fits]\n\nRead 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. [astropy-image-code] [hesela-fits]",
  "related": [
    "fits",
    "checksum",
    "cryptographic-hash",
    "hash-collision"
  ],
  "citations": [
    {
      "id": "proposal",
      "title": "Seaman, Pence and Rots: FITS Checksum Proposal, sections 2-3",
      "url": "https://fits.gsfc.nasa.gov/registry/checksum/checksum.pdf",
      "accessed": "2026-10-18"
    },
    {
      "id": "astropy-code",
      "title": "Astropy v8.0.2: verify_datasum, verify_checksum and warning handling",
      "url": "https://github.com/astropy/astropy/blob/v8.0.2/astropy/io/fits/hdu/base.py",
      "accessed": "2026-10-18"
    },
    {
      "id": "scaling",
      "title": "Astropy: FITS image scaling with BSCALE and BZERO",
      "url": "https://docs.astropy.org/en/stable/io/fits/usage/image.html#scaled-data",
      "accessed": "2026-10-18"
    },
    {
      "id": "cfitsio",
      "title": "CFITSIO C user's guide: File Checksum Routines and DATAOK/HDUOK",
      "url": "https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node50.html",
      "accessed": "2026-10-18"
    },
    {
      "id": "hesela-fits",
      "title": "FITS archive checks: reordered pixels can preserve both checksums",
      "url": "https://hesela.com/analyses/fits-checksums-pixel-order-and-coverage/",
      "accessed": "2026-10-18"
    },
    {
      "id": "astropy-image-code",
      "title": "Astropy v8.0.2 image.py: loaded-image checksum path",
      "url": "https://github.com/astropy/astropy/blob/v8.0.2/astropy/io/fits/hdu/image.py",
      "accessed": "2026-10-18"
    }
  ]
}
