- memset(data, 0x00, sizeof(data));\r
- memset(key, 0x00, sizeof(key));\r
- int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];\r
- \r
- memcpy(data, resp.d.asBytes, len);\r
- \r
- uint64_t corr_uid = 0;\r
- \r
- // this IF? what was I thinking of?\r
- if ( memcmp(data, "\x00\x00\x00\x00", 4) == 0 ) {\r
- corr_uid = ((uint64_t)(data[3] << 24)) | (data[2] << 16) | (data[1] << 8) | data[0];\r
- tryMfk32(corr_uid, data, key);\r
- } else {\r
- corr_uid |= (uint64_t)data[2] << 48; \r
- corr_uid |= (uint64_t)data[1] << 40; \r
- corr_uid |= (uint64_t)data[0] << 32;\r
- corr_uid |= (uint64_t)data[7] << 24;\r
- corr_uid |= (uint64_t)data[6] << 16;\r
- corr_uid |= (uint64_t)data[5] << 8;\r
- corr_uid |= (uint64_t)data[4];\r
- tryMfk64(corr_uid, data, key);\r
- }\r
- PrintAndLog("--");\r
+ memset(data, 0x00, sizeof(data));\r
+ memset(key, 0x00, sizeof(key));\r
+ int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];\r
+ \r
+ memcpy(data, resp.d.asBytes, len);\r
+ \r
+ // CUID is always 4 first bytes.\r
+ uint64_t cuid = bytes_to_num(data, 4 );\r
+ \r
+ // this needs to be fixed. ICEMAN\r
+ if ( memcmp(data, "\x00\x00\x00\x00", 4) == 0 ) {\r
+ tryMfk32(cuid, data, key);\r
+ } else {\r
+ tryMfk64(cuid, data, key);\r
+ }\r