FITS_ASCII_ENCODE
Name
FITS_ASCII_ENCODE()
Purpose
Encode an unsigned longword as an ASCII string to insert in a FITS header
Explanation
Follows the 23 May 2002 version of the FITS checksum proposal at
http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/checksum.html
Calling Sequence
result = FITS_ASCII_ENCODE( sum32)
Inputs
sum32 - 32bit *unsigned longword* (e.g. as returned by CHECKSUM32)
Result
A 16 character scalar string suitable for the CHECKSUM keyword
Example
A FITS header/data unit has a checksum of 868229149. Encode the
complement of this value (3426738146) into an ASCII string
IDL> print,FITS_ASCII_ENCODE(3426738146U)
===> "hcHjjc9ghcEghc9g"
Method
The 32bit value is interpreted as a sequence of 4 unsigned 8 bit
integers, and divided by 4. Add an offset of 48b (ASCII '0').
Remove non-alphanumeric ASCII characters (byte values 58-64 and 91-96)
by simultaneously incrementing and decrementing the values in pairs.
Cyclicly shift the string one place to the right.
Revision History
Written W. Landsman SSAI December 2002