mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Remove unnecessary crc
This commit is contained in:
parent
6f336832da
commit
e7b2dbd5e8
1 changed files with 2 additions and 27 deletions
|
@ -881,37 +881,12 @@ void mifare_cypher_blocks_chained(desfiretag_t tag, desfirekey_t key, uint8_t *i
|
|||
}
|
||||
}
|
||||
|
||||
#define CRC32_PRESET 0xFFFFFFFF
|
||||
|
||||
static void
|
||||
desfire_crc32_byte(uint32_t *crc, const uint8_t value) {
|
||||
/* x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 */
|
||||
const uint32_t poly = 0xEDB88320;
|
||||
|
||||
*crc ^= value;
|
||||
for (int current_bit = 7; current_bit >= 0; current_bit--) {
|
||||
int bit_out = (*crc) & 0x00000001;
|
||||
*crc >>= 1;
|
||||
if (bit_out)
|
||||
*crc ^= poly;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef htole32
|
||||
#define htole32(x) (x)
|
||||
#endif
|
||||
|
||||
void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc) {
|
||||
uint32_t desfire_crc = CRC32_PRESET;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
desfire_crc32_byte(&desfire_crc, data[i]);
|
||||
}
|
||||
|
||||
*((uint32_t *)(crc)) = htole32(desfire_crc);
|
||||
crc32_ex(data,len,crc);
|
||||
}
|
||||
|
||||
void desfire_crc32_append(uint8_t *data, const size_t len) {
|
||||
desfire_crc32(data, len, data + len);
|
||||
crc32_ex(data, len, data + len);
|
||||
}
|
||||
|
||||
void iso14443a_crc_append(uint8_t *data, size_t len) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue