mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 12:59:44 -07:00
mad and ndef compiles
This commit is contained in:
parent
dad556d90c
commit
4caa2ba610
3 changed files with 15 additions and 0 deletions
|
@ -143,6 +143,8 @@ CMDSRCS = $(SRC_SMARTCARD) \
|
|||
whereami.c\
|
||||
mifare/mifarehost.c\
|
||||
mifare/mifare4.c\
|
||||
mifare/mad.c \
|
||||
mifare/ndef.c \
|
||||
parity.c\
|
||||
crc.c \
|
||||
crc16.c \
|
||||
|
|
|
@ -54,3 +54,12 @@ uint32_t CRC8Maxim(uint8_t *buff, size_t size)
|
|||
}
|
||||
return crc_finish(&crc);
|
||||
}
|
||||
|
||||
// width=8 poly=0x1d, init=0xc7 (0xe3 - WRONG! but it mentioned in MAD datasheet) refin=false refout=false xorout=0x00 name="CRC-8/MIFARE-MAD"
|
||||
uint32_t CRC8Mad(uint8_t *buff, size_t size) {
|
||||
crc_t crc;
|
||||
crc_init(&crc, 8, 0x1d, 0xc7, 0);
|
||||
for (int i = 0; i < size; ++i)
|
||||
crc_update(&crc, buff[i], 8);
|
||||
return crc_finish(&crc);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@ extern uint32_t crc_finish(crc_t *crc);
|
|||
|
||||
// Calculate CRC-8/Maxim checksum
|
||||
uint32_t CRC8Maxim(uint8_t *buff, size_t size );
|
||||
|
||||
// Calculate CRC-8 Mifare MAD checksum
|
||||
uint32_t CRC8Mad(uint8_t *buff, size_t size);
|
||||
|
||||
/* Static initialization of a crc structure */
|
||||
#define CRC_INITIALIZER(_order, _polynom, _initial_value, _final_xor) { \
|
||||
.state = ((_initial_value) & ((1L<<(_order))-1)), \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue