The Cyclic Redundancy Check 16 is a hash function that produces a checksum that is used to detect errors in transmissions. More...
Files | |
file | crc16.c |
Implementation of the CRC16 calculcation. | |
file | crc16.h |
Header file for the CRC16 calculcation. | |
Functions | |
unsigned short | crc16_add (unsigned char b, unsigned short crc) |
Update an accumulated CRC16 checksum with one byte. | |
unsigned short | crc16_data (const unsigned char *data, int datalen, unsigned short acc) |
Calculate the CRC16 over a data area. |
The Cyclic Redundancy Check 16 is a hash function that produces a checksum that is used to detect errors in transmissions.
The CRC16 calculation module is an iterative CRC calculator that can be used to cumulatively update a CRC checksum for every incoming byte.
unsigned short crc16_add | ( | unsigned char | b, | |
unsigned short | crc | |||
) |
Update an accumulated CRC16 checksum with one byte.
b | The byte to be added to the checksum | |
crc | The accumulated CRC that is to be updated. |
This function updates an accumulated CRC16 checksum with one byte. It can be used as a running checksum, or to checksum an entire data block.
unsigned short crc16_data | ( | const unsigned char * | data, | |
int | datalen, | |||
unsigned short | acc | |||
) |
Calculate the CRC16 over a data area.
data | Pointer to the data | |
datalen | The length of the data | |
crc | The accumulated CRC that is to be updated (or zero). |
This function calculates the CRC16 checksum of a data area.