# MATH_CalcCRC*

## Syntax

      #include <nitro/math/crc.h>

      u8  MATH_CalcCRC8( const MATHCRC8Table *table, const void* data, u32 dataLength );
      u16 MATH_CalcCRC16( const MATHCRC16Table *table, const void* data, u32 dataLength );
      u16 MATH_CalcCRC16CCITT( const MATHCRC16Table *table, const void* data, u32 dataLength );
      u32 MATH_CalcCRC32( const MATHCRC32Table *table, const void* data, u32 dataLength );
      u32 MATH_CalcCRC32POSIX( const MATHCRC32Table *table, const void* data, u32 dataLength );

## Arguments

table | Pointer to the tables used to compute CRCs.
data | Pointer to the input data.
dataLength | Size of the input data.

## Return Values

Various CRC values

## Description

Performs various CRC computations in one call. You must initialize the `table` argument by calling a `MATH_CRC*InitTable` function in advance.
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.

## See Also

`MATH_CRC*InitTable`, `MATH_CRC*Init`, `MATH_CRC*Update`, `MATH_CRC*GetHash`

## Revision History

2005/04/12 Initial version.

CONFIDENTIAL