Crate pumpkin [−] [src]
A crate for generating large, cryptographically secure prime numbers. These numbers are seeded from the operating system's main source of entropy, ensuring proper randomness.
Numbers are verified to be prime by running the following three tests during initialization:

Dividing the initial prime number candidate by the first 1,000 prime numbers, checking the remainder. Should the remainder ever be zero, then add two to the candidate and try again.

Run a Fermat Primality Test on the candidate. If it doesn't pass, add two to the candidate and goto Step 1.

Finally, complete five rounds of the MillerRabin Primality Test. Should any of the tests pass, add two to the candidate and goto Step 1.
The preceding steps mirror those used by GnuPG, a leading PGP implementation used by thousands of users all across the world.
The prime numbers must be AT LEAST 512bits long. Attempting to generate a number less than 512bits long will cause a panic.
Example
extern crate pumpkin; use pumpkin::prime; fn main() { // Generate 2, 2048bit primes let p = prime::new(2048); let q = prime::new(2048); let n = p * q; println!("{}", n); // Some 4096bit composite number }
Modules
error 
More coming soon 
prime 
Generates cryptographically secure prime numbers. 
safe_prime 
Generates safe prime numbers. 