- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+2;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-2;
-
- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+3;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-3;
-
- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+4;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-4;
-
- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+5;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-5;
-
- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+6;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-6;
-
- nttmp1 = prng_successor_one(nttmp1); if (nttmp1 == nt2) return i+7;
- nttmp2 = prng_successor_one(nttmp2); if (nttmp2 == nt1) return -i-7;
-/*
- if ( prng_successor(nttmp1, i) == nt2) return i;
- if ( prng_successor(nttmp2, i) == nt1) return -i;
-
- if ( prng_successor(nttmp1, i+2) == nt2) return i+2;
- if ( prng_successor(nttmp2, i+2) == nt1) return -(i+2);
-
- if ( prng_successor(nttmp1, i+3) == nt2) return i+3;
- if ( prng_successor(nttmp2, i+3) == nt1) return -(i+3);
-
- if ( prng_successor(nttmp1, i+4) == nt2) return i+4;
- if ( prng_successor(nttmp2, i+4) == nt1) return -(i+4);
-
- if ( prng_successor(nttmp1, i+5) == nt2) return i+5;
- if ( prng_successor(nttmp2, i+5) == nt1) return -(i+5);
-
- if ( prng_successor(nttmp1, i+6) == nt2) return i+6;
- if ( prng_successor(nttmp2, i+6) == nt1) return -(i+6);
-
- if ( prng_successor(nttmp1, i+7) == nt2) return i+7;
- if ( prng_successor(nttmp2, i+7) == nt1) return -(i+7);
-*/
- }
-
- return(-99999); // either nt1 or nt2 are invalid nonces
+ for (i = 1; i < (32768/8); ++i) {
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -i;
+
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+1;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+1);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+2;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+2);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+3;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+3);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+4;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+4);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+5;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+5);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+6;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+6);
+ nttmp1 = prng_successor(nttmp1, 1); if (nttmp1 == nt2) return i+7;
+ nttmp2 = prng_successor(nttmp2, 1); if (nttmp2 == nt1) return -(i+7);
+ }
+ // either nt1 or nt2 are invalid nonces
+ return(-99999);