CRC-8 checksum algorithms. More...

Detailed Description

CRC-8 checksum algorithms.

Files

file  crc8.h
 CRC-8 definitions.
 

Functions

uint8_t crc8 (const uint8_t *data, size_t len, uint8_t poly, uint8_t seed)
 Calculate CRC-8 (MSB first) More...
 
uint8_t crc8_lsb (const uint8_t *data, size_t len, uint8_t poly, uint8_t seed)
 Calculate a reflected CRC-8 (LSB first) More...
 

Function Documentation

◆ crc8()

uint8_t crc8 ( const uint8_t *  data,
size_t  len,
uint8_t  poly,
uint8_t  seed 
)

Calculate CRC-8 (MSB first)

This CRC8 checksum type is usually more common.

Parameters
[in]dataStart of memory area to checksum
[in]lenNumber of bytes in buf to calculate checksum for
[in]polyThe generator polynomial for the checksum
[in]seedThe seed (starting value) for the checksum
Note
A final XOR must be realized by the caller if needed.
Returns
Checksum of the specified memory area.

◆ crc8_lsb()

uint8_t crc8_lsb ( const uint8_t *  data,
size_t  len,
uint8_t  poly,
uint8_t  seed 
)

Calculate a reflected CRC-8 (LSB first)

This CRC8 checksum type is used for example by Onewire.

Parameters
[in]dataStart of memory area to checksum
[in]lenNumber of bytes in buf to calculate checksum for
[in]polyThe generator polynomial for the checksum
[in]seedThe seed (starting value) for the checksum
Note
A final XOR must be realized by the caller if needed.
Returns
Checksum of the specified memory area.