diff options
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/numbertheory/numthry.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp index 58275fb4f..c431fb63f 100644 --- a/src/math/numbertheory/numthry.cpp +++ b/src/math/numbertheory/numthry.cpp @@ -322,8 +322,6 @@ bool primality_test(const BigInt& n, RandomNumberGenerator& rng, size_t level) { - const size_t PREF_NONCE_BITS = 64; - if(n == 2) return true; if(n <= 1 || n.is_even()) @@ -348,6 +346,8 @@ bool primality_test(const BigInt& n, if(level > 2) level = 2; + const size_t PREF_NONCE_BITS = 192; + const size_t NONCE_BITS = std::min(n.bits() - 2, PREF_NONCE_BITS); MillerRabin_Test mr(n); |