19 lines
481 B
C
19 lines
481 B
C
#ifndef __UTIL_CHECKSUM_H_
|
|
#define __UTIL_CHECKSUM_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef uint8_t crc8_t;
|
|
|
|
void crc8_init(crc8_t *crc);
|
|
void crc8_add(crc8_t *crc, uint8_t value);
|
|
void crc8_addSlice(crc8_t *crc, const void *data, size_t size);
|
|
void crc8_finish(crc8_t *crc);
|
|
crc8_t crc8_calc(const void *data, size_t size);
|
|
bool crc8_eq(const crc8_t *a, const crc8_t *b);
|
|
bool crc8_valid(const crc8_t *crc, const void *data, size_t size);
|
|
|
|
#endif
|