mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
add cardx crc skeleton, will need to adapt
This commit is contained in:
parent
588c24b5e3
commit
50d1dfea77
2 changed files with 10 additions and 0 deletions
|
@ -126,3 +126,11 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size) {
|
||||||
crc_update2(&crc, buff[i], 8);
|
crc_update2(&crc, buff[i], 8);
|
||||||
return reflect8(crc_finish(&crc));
|
return reflect8(crc_finish(&crc));
|
||||||
}
|
}
|
||||||
|
// width=8 poly=0x107, init=0x2C refin=true refout=true xorout=0x0000 check=0 name="CRC-8/CARDX"
|
||||||
|
uint32_t CRC8Cardx(uint8_t *buff, size_t size) {
|
||||||
|
crc_t crc;
|
||||||
|
crc_init_ref(&crc, 8, 0x107, 0x2C, 0, true, true);
|
||||||
|
for (size_t i = 0; i < size; ++i)
|
||||||
|
crc_update2(&crc, buff[i], 8);
|
||||||
|
return crc_finish(&crc);
|
||||||
|
}
|
||||||
|
|
|
@ -73,4 +73,6 @@ uint32_t CRC4Legic(uint8_t *buff, size_t size);
|
||||||
// Calculate CRC-8/Legic checksum
|
// Calculate CRC-8/Legic checksum
|
||||||
uint32_t CRC8Legic(uint8_t *buff, size_t size);
|
uint32_t CRC8Legic(uint8_t *buff, size_t size);
|
||||||
|
|
||||||
|
// Calculate CRC-8/Cardx checksum
|
||||||
|
uint32_t CRC8Cardx(uint8_t *buff, size_t size);
|
||||||
#endif /* __CRC_H */
|
#endif /* __CRC_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue