Crate crypto_primes
source ·Expand description
Prime number tools for crypto-bigint
This library implements prime number generation and primality checking for crypto-bigint integers.
In particular:
- Generating random primes and safe primes of given bit size;
- Sieving iterator and one-time trial division by small integers;
- Miller-Rabin test;
- Strong and extra strong Lucas tests, and Lucas-V test.
See the documentation for the specific tests for more information and references.
Modules
Components to build your own primality test.
Handle with care.
Functions
Checks probabilistically if the given number is prime using the provided RNG.
Checks probabilistically if the given number is a safe prime
(that is, such that
(n - 1) / 2 is also prime)
using OsRng as the RNG.Checks probabilistically if the given number is prime using the provided RNG.
Returns a random prime of size
bit_length using the provided RNG.Returns a random safe prime (that is, such that
(n - 1) / 2 is also prime)
of size bit_length using OsRng as the RNG.Returns a random safe prime (that is, such that
(n - 1) / 2 is also prime)
of size bit_length using the provided RNG.