pub trait PrimalityUtils: Integer + Clone {
// Required methods
fn is_prp(&self, base: Self) -> bool;
fn is_sprp(&self, base: Self) -> bool;
fn test_sprp(&self, base: Self) -> Either<bool, Self>;
fn is_lprp(&self, p: Option<usize>, q: Option<isize>) -> bool;
fn is_slprp(&self, p: Option<usize>, q: Option<isize>) -> bool;
fn is_eslprp(&self, p: Option<usize>) -> bool;
}Expand description
This trait implements various primality testing algorithms
Reference:
Required Methods§
Sourcefn is_sprp(&self, base: Self) -> bool
fn is_sprp(&self, base: Self) -> bool
Test if the integer is a strong probable prime (based on Miller-Rabin test).
Sourcefn test_sprp(&self, base: Self) -> Either<bool, Self>
fn test_sprp(&self, base: Self) -> Either<bool, Self>
Do a Miller-Rabin test. The return value is a integer if it finds a factor of the integer, otherwise it reports the test result.
Sourcefn is_lprp(&self, p: Option<usize>, q: Option<isize>) -> bool
fn is_lprp(&self, p: Option<usize>, q: Option<isize>) -> bool
Test if the integer is a Lucas probable prime If either of p, q is not specified, then we will use Selfridge’s Method A to choose p, q
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.