diff --git a/common/crc16.c b/common/crc16.c index b1c2ac248..9fea3d54a 100644 --- a/common/crc16.c +++ b/common/crc16.c @@ -31,6 +31,7 @@ void init_table(CrcType_t crctype) { case CRC_14443_B: case CRC_15693: case CRC_ICLASS: + case CRC_CRYPTORF: generate_table(CRC16_POLY_CCITT, true); break; case CRC_FELICA: @@ -171,6 +172,7 @@ void compute_crc(CrcType_t ct, const uint8_t *d, size_t n, uint8_t *first, uint8 case CRC_14443_A: crc = crc16_a(d, n); break; + case CRC_CRYPTORF: case CRC_14443_B: case CRC_15693: crc = crc16_x25(d, n); @@ -209,6 +211,7 @@ uint16_t Crc16ex(CrcType_t ct, const uint8_t *d, size_t n) { switch (ct) { case CRC_14443_A: return crc16_a(d, n); + case CRC_CRYPTORF: case CRC_14443_B: case CRC_15693: return crc16_x25(d, n); @@ -252,6 +255,7 @@ bool check_crc(CrcType_t ct, const uint8_t *d, size_t n) { switch (ct) { case CRC_14443_A: return (crc16_a(d, n) == 0); + case CRC_CRYPTORF: case CRC_14443_B: return (crc16_x25(d, n) == X25_CRC_CHECK); case CRC_15693: @@ -329,3 +333,4 @@ uint16_t crc16_legic(uint8_t const *d, size_t n, uint8_t uidcrc) { uint16_t initial = uidcrc << 8 | uidcrc; return crc16_fast(d, n, initial, true, true); } + diff --git a/common/crc16.h b/common/crc16.h index 7a273683c..8a726fcaf 100644 --- a/common/crc16.h +++ b/common/crc16.h @@ -29,6 +29,7 @@ typedef enum { CRC_CCITT, CRC_KERMIT, CRC_XMODEM, + CRC_CRYPTORF, } CrcType_t; uint16_t update_crc16_ex(uint16_t crc, uint8_t c, uint16_t polynomial);