Subject: Re: FITS checksum proposal

From: William Pence <[email-masked]>
Date: 4 Jan 1995 18:04:02 -0500

There have been no comments on the FITS CHECKSUM proposal posted here on
20 December by Rob Seaman, so before it fades away, it may be worth
posting a reminder about this proposal to groups that maintain archives
of FITS data, or that distribute FITS files to users, and urge them to
consider adding the CHECKSUM and DATASUM keywords to their FITS files.

These 2 keywords allow the recipient of the FITS file to verify the
integrity of the file and ensure (within some reasonable probability)
that the copied file is identical to the original.  It would be easy to
modify existing FITS reading programs to check for these keywords and
verify the checksum values.  If the computed checksums are not
consistent with the keyword values then the user should be warned that
the file has either been modified since the checksums were inserted, or
that the file is corrupted in some way.

It is not difficult to calculate the checksum from first principles,
but for added convenience, the latest version of the FITSIO subroutine
package (V3.7) contains 2 new subroutines for (a) computing and
inserting the CHECKSUM and DATASUM keywords into any FITS HDU, and (b)
verifying that the computed checksum in a FITS HDU is consistent with
the checksum keywords, if they exist.  The 2 new subroutines are:

        call ftpcks( unit, status)     (Put ChecKSum)

which computes and writes the 2 keywords into the opened FITS file, and
 
        call ftvcks( unit, dataok, hduok, status)  (Verify ChecKSum)

which looks for the 2 keywords in the opened FITS file, and if they exist,
verifies the checksum value.  The dataok and hduok output parameters 
indicate whether the checksum for the data unit alone, and the entire
HDU, respectively, are correct or not.

Finally, the latest version of the VERIFITS program that checks any
FITS file for conformance with the FITS Standard will also verify the
checksum if these keywords exist.

The new versions of FITSIO and VERIFITS that support the checksum
keywords will be made available via anonymous ftp on
legacy.gsfc.nasa.gov in the /software/fitsio and
/software/fitsio/verifits directories by the end of this week.

-Bill Pence