
CRC Utils

This utility can be used to calculate a crc-checksum across given data.
File Structure

utils/
└── crc/
├── crc16.c
└── crc16.h
The library is completely patform independent and can be usesd across a wide range of c-compilers.
Downloads
The library can be downloaded (zip or tar), cloned or used as submodule in a project.
| Type | File | Description |
| Library | zip / tar | CRC library that implements checksum calculation |
Using with git clone
mkdir -p ./utils/
git clone https://github.com/0x007E/utils-crc.git ./utils
mv ./utils/utils-crc ./utils/crc
Using as git submodule
git submodule add https://github.com/0x007E/utils-crc.git ./utils/crc
Programming
#include "../lib/utils/crc/crc16.h"
int main(void)
{
unsigned char data[] = { 0x01, 0xAF, 0xED, 0x30, 0x41 };
unsigned int crc;
for (unsigned char i=0; i < (sizeof(data)/sizeof(data[0])); i++)
{
}
unsigned char checksum[2];
}
void crc16_init(unsigned int value)
Initializes the CRC16 calculation with a specified starting value.
Definition crc16.c:35
void crc16_update(unsigned char data)
Updates the CRC16 value with a single data byte.
Definition crc16.c:53
void crc16_result_array(unsigned char *crc)
Stores the CRC16 result as a two-byte array.
Definition crc16.c:124
void crc16_calculate(unsigned char initial, unsigned char *data, unsigned char length)
Calculates a complete CRC16 checksum over a data buffer.
Definition crc16.c:87
unsigned int crc16_result(void)
Returns the current CRC16 result.
Definition crc16.c:108
#define CRC16_INITIAL_VALUE
Default initial value for CRC16 calculation.
Definition crc16.h:35
Additional Information
| Type | Link | Description |
| AppNote | pdf | Application note for CRC16 |
R. GAECHTER