#include <nitro/math/crc.h>
void MATH_CRC8Update( const MATHCRC8Table *table, MATHCRC8Context *context, const void* input, u32 length );
void MATH_CRC16Update( const MATHCRC16Table *table, MATHCRC16Context *context, const void* input, u32 length );
void MATH_CRC16CCITTUpdate( const MATHCRC16Table *table, MATHCRC16Context *context, const void* input, u32 length );
void MATH_CRC32Update( const MATHCRC32Table *table, MATHCRC32Context *context, const void* input, u32 length );
void MATH_CRC32POSIXUpdate( const MATHCRC32Table *table, MATHCRC32Context *context, const void* input, u32 length );
table | Pointer to the tables used to compute CRCs |
context |
Pointer to the context structure used for various CRC calculations. |
input | Pointer to the input data |
length | Size of the input data |
None.
Updates the various CRC hash values based on the input data. You must first initialize the 'table' argument using the MATH_CRC*InitTable
function and the 'context' argument using the MATH_CRC*Init
function. Call this function as many times as needed, and then use MATH_CRC*GetHash
to obtain the hash value. Any size and alignment position can be used for the input data.
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*InitTable
, MATH_CRC*Init
, MATH_CRC*GetHash
04/12/2005 Initial version.