From 7431536de760a7d2f5c810f1a46ec76488479d9a Mon Sep 17 00:00:00 2001 From: "dn337t@gmail.com" Date: Tue, 29 May 2012 13:23:07 +0000 Subject: [PATCH] optimized loop in MifareNested (issue 36) --- armsrc/mifarecmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 4148a3c2..b2b38edf 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -417,8 +417,9 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain) } ncount = 0; - for (m = dmin - NS_TOLERANCE; m < dmax + NS_TOLERANCE; m++) { - nttest = prng_successor(nt1, m); + nttest = prng_successor(nt1, dmin - NS_TOLERANCE); + for (m = dmin - NS_TOLERANCE + 1; m < dmax + NS_TOLERANCE; m++) { + nttest = prng_successor(nttest, 1); ks1 = nt2 ^ nttest; if (valid_nonce(nttest, nt2, ks1, par_array) && (ncount < 11)){ -- 2.39.5