statelist->head.slhead = lfsr_recovery32(statelist->ks1, statelist->nt ^ statelist->uid); \r
\r
for (p1 = statelist->head.slhead; *(uint64_t *)p1 != 0; p1++);\r
statelist->head.slhead = lfsr_recovery32(statelist->ks1, statelist->nt ^ statelist->uid); \r
\r
for (p1 = statelist->head.slhead; *(uint64_t *)p1 != 0; p1++);\r
statelist->len = p1 - statelist->head.slhead;\r
statelist->tail.sltail = --p1;\r
qsort(statelist->head.slhead, statelist->len, sizeof(uint64_t), Compare16Bits);\r
statelist->len = p1 - statelist->head.slhead;\r
statelist->tail.sltail = --p1;\r
qsort(statelist->head.slhead, statelist->len, sizeof(uint64_t), Compare16Bits);\r
// uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt;\r
uint8_t keyBlock[USB_CMD_DATA_SIZE] = {0x00};\r
\r
// uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt;\r
uint8_t keyBlock[USB_CMD_DATA_SIZE] = {0x00};\r
\r
for (i = 0; i < numOfCandidates; ++i){\r
crypto1_get_lfsr(statelists[0].head.slhead + i, &key64);\r
num_to_bytes(key64, 6, keyBlock + i * 6);\r
for (i = 0; i < numOfCandidates; ++i){\r
crypto1_get_lfsr(statelists[0].head.slhead + i, &key64);\r
num_to_bytes(key64, 6, keyBlock + i * 6);\r
free(statelists[1].head.slhead);\r
num_to_bytes(key64, 6, resultKey);\r
\r
free(statelists[1].head.slhead);\r
num_to_bytes(key64, 6, resultKey);\r
\r
PrintAndLog("UID: %08x target block:%3u key type: %c -- Found key [%012"llx"]",\r
uid,\r
(uint16_t)resp.arg[2] & 0xff,\r
PrintAndLog("UID: %08x target block:%3u key type: %c -- Found key [%012"llx"]",\r
uid,\r
(uint16_t)resp.arg[2] & 0xff,\r
if ((resp.arg[0] & 0xff) != 0x01) return 2;\r
*key = bytes_to_num(resp.d.asBytes, 6);\r
return 0;\r
if ((resp.arg[0] & 0xff) != 0x01) return 2;\r
*key = bytes_to_num(resp.d.asBytes, 6);\r
return 0;\r