Redundant primality test in gen_safe_prime
milapsheth opened this issue · comments
The function to generate a safe prime, gen_safe_prime
, performs another primality test on the random prime that was just generated.
Specifically, in gen_safe_prime, gen_prime
returns a probable prime, but the next check _is_safe_prime(...) && lucas(...)
tests again that candidate
is a prime. This is already done in gen_prime
, so we now only need to check if (candidate - 1)/2
is also prime.