CRC16-CCITT checksum algorithm. More...
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_update() with the desired start value instead of 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.
Files | |
| file | crc16_ccitt.h |
Functions | |
| uint16_t | crc16_ccitt_update (uint16_t crc, const unsigned char *buf, size_t len) |
| Update CRC16-CCITT. More... | |
| uint16_t | crc16_ccitt_calc (const unsigned char *buf, size_t len) |
| Calculate CRC16-CCITT. More... | |
| uint16_t crc16_ccitt_calc | ( | const unsigned char * | buf, |
| size_t | len | ||
| ) |
Calculate CRC16-CCITT.
| [in] | buf | Start of the memory area to checksum |
| [in] | len | Number of bytes to checksum |
| uint16_t crc16_ccitt_update | ( | uint16_t | crc, |
| const unsigned char * | buf, | ||
| size_t | len | ||
| ) |
Update CRC16-CCITT.
| [in] | crc | A start value for the CRC calculation, usually the return value of a previous call to crc16_ccitt_calc() or crc16_ccitt_update() |
| [in] | buf | Start of the memory area to checksum |
| [in] | len | Number of bytes to checksum |