Skip to content

Commit

Permalink
Use only Baillie-PSW primality test when hashing to prime
Browse files Browse the repository at this point in the history
This increases performance of hashing to prime when generating the
discriminant by about 2x.
  • Loading branch information
rostislav authored and hoffmang9 committed Jan 6, 2021
1 parent 697e514 commit a966875
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/integer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ struct integer {
}

bool prime() const {
return mpz_probab_prime_p(impl, 50)!=0;
// reps=24 makes GMP 6.2.1 do only the Baillie-PSW primality test
// without additional Miller-Rabin rounds.
return mpz_probab_prime_p(impl, 24) != 0;
}

bool operator<(const integer& t) const {
Expand Down

0 comments on commit a966875

Please sign in to comment.