entropyxyz / crypto-primes

Random prime generation and primality testing library based on `crypto-bigint`.
https://docs.rs/crypto-primes
Apache License 2.0
17 stars 4 forks source link

More descriptive return type for primality checks #5

Closed fjarri closed 1 year ago

fjarri commented 1 year ago

Currently the primality checking functions return bool, which may occasionally be confusing, and also does not distinguish between "definitely prime" and "probably prime" (although with the intended usage of this library, the former would be pretty rare, since we can only tell that during the trial division phase). Should we instead follow num-prime and return an enum like Primality?

fjarri commented 1 year ago

Added in d6b7d42a6029bee71ff714ad96af4797b677152c for hazmat functions. The ones in presets will continue to return bool because the idea of presets is that it contains a vetted sequence of checks that is supposed to be trusted.