add ref for cryptorf which uses 14b crc

This commit is contained in:
iceman1001 2020-08-21 14:11:24 +02:00
commit db9818abe4
2 changed files with 6 additions and 0 deletions

View file

@ -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);
}

View file

@ -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);