Skip to main content

next_prime

Function next_prime 

Source
pub(crate) fn next_prime<U: UnsignedWithMontyForm + RandomMod>(
    rng: impl CryptoRng,
    seed: U,
    bits_of_security: u32,
) -> Result<U, Error>
Expand description

Get the next prime greater than or equal to the seed.

This function runs in variable time.

The returned value is composite with probability 2^{-bits_of_security}, per FIPS-186.5, for parameterization of the Miller-Rabin test, unconditionally followed by a Lucas test.