CRC16-CCITT¶
CRC16-CCITT checksum algorithm.
This implementation of CRC16 is based on the CCITT specification using 0x1D0F as a start value. Using a different start value is possible by calling crc16_ccitt.h::crc16_ccitt_update()
with the desired start value instead of crc16_ccitt.h::crc16_ccitt_calc()
.
There is a more generalized version in CRC16 (lightweight), that does not utilize a look-up table as this implementation does (and is thus also for more memory efficient). Its caveat however is that it is slower by about factor 8 than this version.
-
uint16_t
crc16_ccitt_update
(uint16_t crc, const unsigned char * buf,msp430_types.h::size_t
len)¶ Update CRC16-CCITT.
Parameters
crc: A start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt.h::crc16_ccitt_calc()
orcrc16_ccitt.h::crc16_ccitt_update()
buf: Start of the memory area to checksum len: Number of bytes to checksum Return values
- Checksum of the specified memory area based on the given start value
-
uint16_t
crc16_ccitt_calc
(const unsigned char * buf,msp430_types.h::size_t
len)¶ Calculate CRC16-CCITT.
Parameters
buf: Start of the memory area to checksum len: Number of bytes to checksum Return values
- Checksum of the specified memory area