pub struct Verification;Expand description
§Prime Verification
This struct is used to verify whether integers are prime, safe prime, or composite.
use num_primes::{Generator,Verification};
fn main(){
let prime = Generator::new_prime(1024);
let safe = Generator::safe_prime(128);
let is_prime: bool = Verification::is_prime(&prime);
let is_safe_prime: bool = Verification::is_safe_prime(&safe);
assert_eq!(is_prime, true);
assert_eq!(is_safe_prime, true);
}Implementations§
Source§impl Verification
impl Verification
pub fn is_composite(n: &BigUint) -> bool
Sourcepub fn is_safe_prime(n: &BigUint) -> bool
pub fn is_safe_prime(n: &BigUint) -> bool
Sourcepub fn is_very_smooth_number(m: &BigUint, n: f64, c: u32) -> bool
pub fn is_very_smooth_number(m: &BigUint, n: f64, c: u32) -> bool
§Very Smooth Number
This Function Is Deprecated And Should Rarely Be Used
use num_traits::FromPrimitive;
use num_bigint::BigUint;
use num_primes::Verification;
fn main(){
// Set BigUint To 7
let x: BigUint = BigUint::from_u64(7u64).unwrap();
// Verify Its A Smooth Number
let result: bool = Verification::is_smooth_number(&x,31.0,5);
println!("Is A {} Smooth Number: {}",x,result);
}Auto Trait Implementations§
impl Freeze for Verification
impl RefUnwindSafe for Verification
impl Send for Verification
impl Sync for Verification
impl Unpin for Verification
impl UnsafeUnpin for Verification
impl UnwindSafe for Verification
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