+ // Authenticate response - nonce
+ uint8_t *resp1 = (((uint8_t *)BigBuf) + CARD_MEMORY);
+ int resp1Len;
+ uint8_t *resp2 = (((uint8_t *)BigBuf) + CARD_MEMORY + 200);
+ int resp2Len;
+ CodeIso14443aAsTag(rAUTH_NT, sizeof(rAUTH_NT));
+ memcpy(resp1, ToSend, ToSendMax); resp1Len = ToSendMax;
+
+ timer = GetTickCount();
+ uint32_t nonce = bytes_to_num(rAUTH_NT, 4);
+ uint32_t rn_enc = 0x98d76b77; // !!!!!!!!!!!!!!!!!
+ uint32_t ans = 0;
+ cuid = bytes_to_num(rUIDBCC1, 4);
+
+ crypto1_create(pcs, key64);
+ crypto1_word(pcs, cuid ^ nonce, 0);
+ crypto1_word(pcs, rn_enc , 1);
+ crypto1_word(pcs, 0, 0);
+ ans = prng_successor(nonce, 96) ^ crypto1_word(pcs, 0, 0);
+ num_to_bytes(ans, 4, rAUTH_AT);
+ CodeIso14443aAsTag(rAUTH_AT, sizeof(rAUTH_AT));
+ memcpy(resp2, ToSend, ToSendMax); resp2Len = ToSendMax;
+ Dbprintf("crypto auth time: %d", GetTickCount() - timer);