-- © Copyright 2000 by John Halleck, All Rights Reserved. -- PNG's CRC. It is defined by ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-T-V42]. -- It uses the CRC polynomial: -- x^32 + x^26 + x^23 + x^22 + x^16 -- + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 -- This implementation is more or less directly from the PNG standard. -- There is nothing in this spec that cares what the Polynomial is... -- it is all in the body. (I reuse this spec (renamed) for lots of CRC's) with Interfaces; use Interfaces; -- We need portable unsigned types. package PNG_CRC is pragma Pure (PNG_CRC); type CRC is new Unsigned_32; type State is private; procedure Initialize (Given : out State); -- Start out a state. pragma Inline (Initialize); procedure Process_Data (Given : in out State; Byte : Unsigned_8); pragma Inline (Process_Data); function Final_CRC (Given : in State) return CRC; pragma Inline (Final_CRC); -- Just CRC a string. function Process_String (Given : String) return CRC; private type State is new Unsigned_32; end PNG_CRC;
This page is http://www.cc.utah.edu/~nahaj/ada/crc/png_crc.ads.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 11th, 2000
And the underlying file was last modified on August 5th, 2000