mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 14:23:50 -07:00
Chg : 'hf thinfilm info' - added crc check
This commit is contained in:
parent
118c8478f0
commit
a331090c6a
1 changed files with 14 additions and 5 deletions
|
@ -29,7 +29,16 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len) {
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, " Manufacturer : "_YELLOW_("%s") "[0x%02X]", (barcode[0] == 0xB7) ? "Thinfilm" : "unknown", barcode[0] );
|
PrintAndLogEx(SUCCESS, " Manufacturer : "_YELLOW_("%s") "[0x%02X]", (barcode[0] == 0xB7) ? "Thinfilm" : "unknown", barcode[0] );
|
||||||
PrintAndLogEx(SUCCESS, " Data format : "_YELLOW_("%02X"), barcode[1]);
|
PrintAndLogEx(SUCCESS, " Data format : "_YELLOW_("%02X"), barcode[1]);
|
||||||
PrintAndLogEx(SUCCESS, " Raw data : "_YELLOW_("%s"), sprint_hex(barcode, barcode_len) );
|
|
||||||
|
uint8_t b1, b2;
|
||||||
|
compute_crc(CRC_14443_A, barcode, barcode_len - 2, &b1, &b2);
|
||||||
|
bool isok = (barcode[barcode_len - 1] == b1 && barcode[barcode_len - 2] == b2);
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, " checksum : "_YELLOW_("%02X %02X")"- %s", b2, b1, (isok) ? _GREEN_("OK") : _RED_("fail"));
|
||||||
|
PrintAndLogEx(SUCCESS, " Raw data : "_YELLOW_("%s"),
|
||||||
|
sprint_hex(barcode, barcode_len)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
char s[45];
|
char s[45];
|
||||||
memset(s, 0x00, sizeof(s));
|
memset(s, 0x00, sizeof(s));
|
||||||
|
@ -59,7 +68,7 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(s + strlen(s), barcode_len - 1, (const char*)&barcode[2] , barcode_len - 2);
|
snprintf(s + strlen(s), barcode_len - 3, (const char*)&barcode[2] , barcode_len - 4);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < strlen(s); i++) {
|
for (uint8_t i = 0; i < strlen(s); i++) {
|
||||||
|
|
||||||
|
@ -110,7 +119,7 @@ int infoThinFilm(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( resp.status == PM3_SUCCESS ) {
|
if ( resp.status == PM3_SUCCESS ) {
|
||||||
print_barcode( resp.data.asBytes, resp.length - 2);
|
print_barcode( resp.data.asBytes, resp.length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.status;
|
return resp.status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue