diff options
author | lloyd <[email protected]> | 2014-04-13 19:20:36 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-04-13 19:20:36 +0000 |
commit | 340cc7f520ef95aeb7a4692357b870003dd7f0f8 (patch) | |
tree | 28c9c1dfb02e99b2c378aae142b8e1e9a83ec276 /src/lib/math/numbertheory/numthry.h | |
parent | c30ff3c1b1308346de33397ab282d1f2831d0936 (diff) |
Use 20 Miller-Rabin iterations regardless of the size of the integer. This
provides a much better worst-case error bound. Also take the nonce from anywhere
in the usable range rather than limiting the bit size.
Diffstat (limited to 'src/lib/math/numbertheory/numthry.h')
-rw-r--r-- | src/lib/math/numbertheory/numthry.h | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h index a34d855b2..cb73356b2 100644 --- a/src/lib/math/numbertheory/numthry.h +++ b/src/lib/math/numbertheory/numthry.h @@ -123,44 +123,12 @@ word BOTAN_DLL monty_inverse(word input); size_t BOTAN_DLL low_zero_bits(const BigInt& x); /** -* Primality Testing -* @param n a positive integer to test for primality -* @param rng a random number generator -* @param level how hard to test -* @return true if all primality tests passed, otherwise false -*/ -bool BOTAN_DLL primality_test(const BigInt& n, - RandomNumberGenerator& rng, - size_t level = 1); - -/** -* Quickly check for primality -* @param n a positive integer to test for primality -* @param rng a random number generator -* @return true if all primality tests passed, otherwise false -*/ -inline bool quick_check_prime(const BigInt& n, RandomNumberGenerator& rng) - { return primality_test(n, rng, 0); } - -/** * Check for primality * @param n a positive integer to test for primality * @param rng a random number generator * @return true if all primality tests passed, otherwise false */ -inline bool check_prime(const BigInt& n, RandomNumberGenerator& rng) - { return primality_test(n, rng, 1); } - -/** -* Verify primality - this function is slow but useful if you want to -* ensure that a possibly malicious entity did not provide you with -* something that 'looks like' a prime -* @param n a positive integer to test for primality -* @param rng a random number generator -* @return true if all primality tests passed, otherwise false -*/ -inline bool verify_prime(const BigInt& n, RandomNumberGenerator& rng) - { return primality_test(n, rng, 2); } +bool BOTAN_DLL check_prime(const BigInt& n, RandomNumberGenerator& rng); /** * Randomly generate a prime |