Trait num_prime::PrimalityUtils
source · 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
Object Safety§
This trait is not object safe.