- char uid_string[20];
- for (uint16_t i = 0; i < card->uidlen; i++) {
- sprintf(&uid_string[2*i], "%02X", card->uid[i]);
+ // check if UID is 4 bytes
+ if ((card->atqa[1] & 0xC0) == 0) {
+ PrintAndLog("%02X%02X%02X%02X",
+ *uid, *(uid + 1), *(uid + 2), *(uid + 3));
+ } else {
+ PrintAndLog("UID longer than 4 bytes");