#include <nitro/math/crc.h>
static inline void MATH_CRC8Init( MATHCRC8Context *context );
static inline void MATH_CRC16Init( MATHCRC16Context *context );
static inline void MATH_CRC16CCITTInit( MATHCRC16Context *context );
static inline void MATH_CRC32Init( MATHCRC32Context *context );
static inline void MATH_CRC32POSIXInit( MATHCRC32Context *context );
context |
Pointer to the context structure to initialize for CRC calculations. |
None.
Initializes a context structure of type MATHCRC*Context
, which is used for calculating CRCs.
Make sure that this function is called before using MATH_CRC*Update
or MATH_CRC*GetHash
.
You can re-apply this function to a context structure that is already initialized. In this case, it will return the context structure to its initial state.
CRC-8 is an algorithm that finds an 8-bit hash value.
CRC-16 and CRC-16/CCITT are algorithms that find 16-bit hash values.
CRC-32 and CRC-32/POSIX are algorithms that find 32-bit hash values. CRC-16 is the algorithm used in the ARC and LHA compression programs. One restriction is that the hash value does not change when a 0
byte is appended to the top. CRC-16/CCITT is an algorithm that is used in many data link layer standards as a FCS (Frame Check Sequence). It is defined in the x.25 standard of the CCITT (Comite Consultatif International Telegraphique et Telephonique). CRC-32 is an algorithm used in compression programs, such as PKZIP, and image formats, such as PNG. For details, see ISO 3309 and RFC 2083. CRC-32/POSIX is an algorithm used in the cksum command, which is included in POSIX-compliant Unix. It is defined in POSIX 1003.2. With the cksum
command, CRC is taken after the file length is appended to the end of the input file.
MATH_CRC*Update
, MATH_CRC*GetHash
04/12/2005 Initial version.