pub struct MillerRabin<T: Integer> { /* private fields */ }Expand description
Precomputed data used to perform Miller-Rabin primality test1.
The numbers that pass it are commonly called “strong probable primes” (or “strong pseudoprimes” if they are, in fact, composite).
C. Pomerance, J. L. Selfridge, S. S. Wagstaff “The Pseudoprimes to 25*10^9”, Math. Comp. 35 1003-1026 (1980), DOI: 10.2307/2006210
Implementations§
Source§impl<T: Integer + RandomMod> MillerRabin<T>
impl<T: Integer + RandomMod> MillerRabin<T>
Sourcepub fn test_base_two(&self) -> Primality
pub fn test_base_two(&self) -> Primality
Perform a Miller-Rabin check with base 2.
Sourcepub fn test_random_base(
&self,
rng: &mut (impl CryptoRngCore + ?Sized),
) -> Primality
pub fn test_random_base( &self, rng: &mut (impl CryptoRngCore + ?Sized), ) -> Primality
Perform a Miller-Rabin check with a random base (in the range [3, candidate-2])
drawn using the provided RNG.
Note: panics if candidate == 3 (so the range above is empty).
Trait Implementations§
Source§impl<T: Clone + Integer> Clone for MillerRabin<T>
impl<T: Clone + Integer> Clone for MillerRabin<T>
Source§fn clone(&self) -> MillerRabin<T>
fn clone(&self) -> MillerRabin<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Eq + Integer> Eq for MillerRabin<T>
impl<T: Integer> StructuralPartialEq for MillerRabin<T>
Auto Trait Implementations§
impl<T> Freeze for MillerRabin<T>
impl<T> RefUnwindSafe for MillerRabin<T>where
T: RefUnwindSafe,
<<T as Integer>::Monty as Monty>::Params: RefUnwindSafe,
<T as Integer>::Monty: RefUnwindSafe,
impl<T> Send for MillerRabin<T>
impl<T> Sync for MillerRabin<T>
impl<T> Unpin for MillerRabin<T>
impl<T> UnwindSafe for MillerRabin<T>where
T: UnwindSafe,
<<T as Integer>::Monty as Monty>::Params: UnwindSafe,
<T as Integer>::Monty: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more