# Crate scicrypt_numbertheory

source · [−]## Expand description

*This is a part of scicrypt. For more information, head to the
scicrypt crate homepage.*

Number theoretic functions, particularly suited for cryptography. Functions include extremely fast (safe) prime generation.

## Functions

Generates a uniformly random prime number of a given bit length. So, the number contains
`bit_length`

bits, of which the first and the last bit are always 1.

Generates a uniformly random RSA modulus, which is the product of two safe primes $p$ and $q$. This method returns both the modulus and $\lambda$, which is the least common multiple of $p - 1$ and $q - 1$.

Generates a uniformly random *safe* prime number of a given bit length. This is a prime $p$ of
the form $p = 2q + 1$, where $q$ is a smaller prime.