Loading...
Searching...
No Matches
CRC16-CCITT

Variations of CRC16-CCITT checksum algorithms. More...

Detailed Description

Variations of CRC16-CCITT checksum algorithms.

This provides implementations for multiple variations of CRC16 checks.

There is a more generalized version in CRC16 (lightweight), that does not optionally utilize a look-up table as these implementations can do (and is thus also far more memory efficient). Its caveat however is that it is slower by about factor 8 than these versions when enabling the look-up table.

Note
enable the crc16_fast module for a look-up table based implementation that trades code size for speed.

Files

file  crc16_ccitt.h
 

Functions

uint16_t crc16_ccitt_kermit_update (uint16_t crc, const unsigned char *buf, size_t len)
 Update CRC16-CCITT-KERMIT.
 
uint16_t crc16_ccitt_kermit_calc (const unsigned char *buf, size_t len)
 Calculate CRC16-CCITT-KERMIT.
 
static uint16_t crc16_ccitt_mcrf4xx_update (uint16_t crc, const unsigned char *buf, size_t len)
 Update CRC16-CCITT-MCRF4XX.
 
uint16_t crc16_ccitt_mcrf4xx_calc (const unsigned char *buf, size_t len)
 Calculate CRC16-CCITT-MCRF4XX.
 
uint16_t crc16_ccitt_false_update (uint16_t crc, const unsigned char *buf, size_t len)
 Update CRC16-CCITT-FALSE.
 
uint16_t crc16_ccitt_false_calc (const unsigned char *buf, size_t len)
 Calculate CRC16-CCITT-FALSE.
 
static uint16_t crc16_ccitt_aug_update (uint16_t crc, const unsigned char *buf, size_t len)
 Update CRC16-CCITT-AUG.
 
uint16_t crc16_ccitt_aug_calc (const unsigned char *buf, size_t len)
 Calculate CRC16-CCITT-AUG.
 

Function Documentation

◆ crc16_ccitt_aug_calc()

uint16_t crc16_ccitt_aug_calc ( const unsigned char *  buf,
size_t  len 
)

Calculate CRC16-CCITT-AUG.

Parameter Value
Polynom 0x1021
Init 0x1d0f
Refin false
Refout false
Xorout 0x0000
Check 0xe5cc
Parameters
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area

◆ crc16_ccitt_aug_update()

static uint16_t crc16_ccitt_aug_update ( uint16_t  crc,
const unsigned char *  buf,
size_t  len 
)
inlinestatic

Update CRC16-CCITT-AUG.

Parameters
[in]crcA start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt_aug_calc() or crc16_ccitt_aug_update()
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area based on the given start value

Definition at line 159 of file crc16_ccitt.h.

◆ crc16_ccitt_false_calc()

uint16_t crc16_ccitt_false_calc ( const unsigned char *  buf,
size_t  len 
)

Calculate CRC16-CCITT-FALSE.

Parameter Value
Polynom 0x1021
Init 0xffff
Refin false
Refout false
Xorout 0x0000
Check 0x29b1
Parameters
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area

◆ crc16_ccitt_false_update()

uint16_t crc16_ccitt_false_update ( uint16_t  crc,
const unsigned char *  buf,
size_t  len 
)

Update CRC16-CCITT-FALSE.

Parameters
[in]crcA start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt_false_calc() or crc16_ccitt_false_update()
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area based on the given start value

◆ crc16_ccitt_kermit_calc()

uint16_t crc16_ccitt_kermit_calc ( const unsigned char *  buf,
size_t  len 
)

Calculate CRC16-CCITT-KERMIT.

Parameter Value
Polynom 0x1021
Init 0x0000
Refin true
Refout true
Xorout 0x0000
Check 0x2189
Parameters
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area

◆ crc16_ccitt_kermit_update()

uint16_t crc16_ccitt_kermit_update ( uint16_t  crc,
const unsigned char *  buf,
size_t  len 
)

Update CRC16-CCITT-KERMIT.

Parameters
[in]crcA start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt_kermit_calc() or crc16_ccitt_kermit_update()
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area based on the given start value

◆ crc16_ccitt_mcrf4xx_calc()

uint16_t crc16_ccitt_mcrf4xx_calc ( const unsigned char *  buf,
size_t  len 
)

Calculate CRC16-CCITT-MCRF4XX.

Parameter Value
Polynom 0x1021
Init 0xffff
Refin true
Refout true
Xorout 0x0000
Check 0x6f91
Parameters
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area

◆ crc16_ccitt_mcrf4xx_update()

static uint16_t crc16_ccitt_mcrf4xx_update ( uint16_t  crc,
const unsigned char *  buf,
size_t  len 
)
inlinestatic

Update CRC16-CCITT-MCRF4XX.

Parameters
[in]crcA start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt_mcrf4xx_calc() or crc16_ccitt_mcrf4xx_update()
[in]bufStart of the memory area to checksum
[in]lenNumber of bytes to checksum
Returns
Checksum of the specified memory area based on the given start value

Definition at line 87 of file crc16_ccitt.h.