pub trait RandPrime<T> {
    fn gen_prime(
        &mut self,
        bit_size: usize,
        config: Option<PrimalityTestConfig>
    ) -> T; fn gen_prime_exact(
        &mut self,
        bit_size: usize,
        config: Option<PrimalityTestConfig>
    ) -> T; fn gen_safe_prime(&mut self, bit_size: usize) -> T; fn gen_safe_prime_exact(&mut self, bit_size: usize) -> T; }
Expand description

Supports random generation of primes

Required Methods

Generate a random prime within the given bit size limit

Panics

if the bit_size is 0 or it’s larger than the bit width of the integer

Generate a random prime with exact the given bit size

Panics

if the bit_size is 0 or it’s larger than the bit width of the integer

Generate a random (Sophie German) safe prime within the given bit size limit. The generated prime is guaranteed to pass the is_safe_prime test

Panics

if the bit_size is 0 or it’s larger than the bit width of the integer

Generate a random (Sophie German) safe prime with the exact given bit size. The generated prime is guaranteed to pass the is_safe_prime test

Panics

if the bit_size is 0 or it’s larger than the bit width of the integer

Implementors