diff --git a/src/crypto/public_key/prime.js b/src/crypto/public_key/prime.js index 8824a52e..42d5e8f6 100644 --- a/src/crypto/public_key/prime.js +++ b/src/crypto/public_key/prime.js @@ -57,6 +57,7 @@ async function randomProbablePrime(bits, e, k) { // If reached the maximum, go back to the minimum. if (n.bitLength() > bits) { n = n.mod(min.shln(1)).iadd(min); + i = n.mod(thirty).toNumber(); } // eslint-disable-next-line no-await-in-loop } while (!await isProbablePrime(n, e, k));