14 #include "math/bytelib.h"
18 #define CRC16CCITT 0x1021
19 #define CRC16CCITTMSB 0x1021
20 #define CRC16CCITTMSBINIT 0xffff
22 #define CRC16CCITTR 0x8408
23 #define CRC16CCITTLSB 0x8408
24 #define CRC16CCITTLSBINIT 0x0000
26 #define CRC16CCITTRR 0x8810
28 uint16_t calc_crc16ccitt(uint8_t *buf,
int size,
bool lsb=
true);
29 uint16_t calc_crc16(uint8_t *buf, uint16_t size, uint16_t poly=CRC16CCITTMSB, uint16_t crc=CRC16CCITTMSBINIT, uint16_t xorout=0x0,
bool lsbfirst=
false);
30 uint16_t calc_crc16(vector<uint8_t> buf, uint16_t poly=CRC16CCITTMSB, uint16_t crc=CRC16CCITTMSBINIT, uint16_t xorout=0x0,
bool lsbfirst=
false);
31 uint16_t calc_crc16ccitt_lsb(
string buf, uint16_t initialcrc=CRC16CCITTLSBINIT, uint16_t skip=0);
32 uint16_t calc_crc16ccitt_lsb(vector<uint8_t> &buf, uint16_t initialcrc=CRC16CCITTLSBINIT, uint16_t skip=0);
33 uint16_t calc_crc16ccitt_lsb(uint8_t *buf, uint16_t size, uint16_t initialcrc=CRC16CCITTLSBINIT);
34 uint16_t calc_crc16_lsb(uint8_t *buf, uint16_t size, uint16_t poly=CRC16CCITTLSB, uint16_t crc=CRC16CCITTLSBINIT, uint16_t xorout=0x0);
35 uint16_t calc_crc16_lsb(vector<uint8_t> &buf, uint16_t poly=CRC16CCITTLSB, uint16_t crc=CRC16CCITTLSBINIT, uint16_t xorout=0x0, uint16_t skip=0);
36 uint16_t calc_crc16ccitt_msb(
string buf, uint16_t initialcrc=CRC16CCITTMSBINIT, uint16_t skip=0);
37 uint16_t calc_crc16ccitt_msb(vector<uint8_t> &buf, uint16_t initialcrc=CRC16CCITTMSBINIT, uint16_t skip=0);
38 uint16_t calc_crc16ccitt_msb(uint8_t *buf, uint16_t size, uint16_t initialcrc=CRC16CCITTMSBINIT);
39 uint16_t calc_crc16_msb(uint8_t *buf, uint16_t size, uint16_t poly=CRC16CCITTMSB, uint16_t crc=CRC16CCITTMSBINIT, uint16_t xorout=0x0);
40 uint16_t calc_crc16_msb(vector<uint8_t> &buf, uint16_t poly=CRC16CCITTMSB, uint16_t crc=CRC16CCITTMSBINIT, uint16_t xorout=0x0, uint16_t skip=0);
56 std::map<string, crcset> types;
59 uint16_t set(
string type);
60 uint16_t set(uint16_t polynomial=0x1021, uint16_t initialcrc=0xffff, uint16_t xorout=0x0,
bool lsbfirst=
false);
61 uint16_t calc(vector<uint8_t> message);
62 uint16_t calc(vector<uint8_t> message, uint16_t size);
63 uint16_t calc(
string message, uint16_t size);
64 uint16_t calc(
string message);
65 uint16_t calc(uint8_t *message, uint16_t size);
66 int32_t calc_file(
string file_path);
69 string type =
"ccitt-false";
CRC16()
Calculate CRC-16.
Definition: crclib.cpp:8