NAME
Math::Prime::Util::RandomPrimesGMP - Generate random primes using MPU::GMP
VERSION
Version 0.61
SYNOPSIS
DESCRIPTION
Routines to generate random primes.
RANDOM PRIME FUNCTIONS
random_prime
Generate a random prime between low
and high
.
random_ndigit_prime
Generate a random prime with n
digits. n
must be at least 1.
random_nbit_prime
Generate a random prime with n
bits. n
must be at least 2.
random_strong_prime
Generate a random strong prime with n
bits. n
must be at least 128.
random_maurer_prime
Generate a random proven prime with n
bits using Maurer's algorithm. n
must be at least 2.
random_shawe_taylor_prime
Generate a random proven prime with n
bits using Shawe-Taylor's algorithm from FIPS 186-4. n
must be at least 2.
random_maurer_prime_with_cert
As "random_maurer_prime" but also returns a certificate string.
random_shawe_taylor_prime_with_cert
As "random_shawe_taylor_prime" but also returns a certificate string.
random_proven_prime
Generate or construct a random provable prime of n
bits. n
must be at least 2.
random_proven_prime_with_cert
Generate or construct a random provable prime of n
bits. n
must be at least 2. Returns a list of two items: the prime and the certificate.
RANDOM PRIMALITY FUNCTIONS
miller_rabin_random
Given a number n
and a number of tests to perform k
, this does k
Miller-Rabin tests on n
using randomly selected bases. The return value is 1 if all bases are a witness to to n
, or 0 if any of them fail.
SEE ALSO
AUTHORS
Dana Jacobsen <dana@acm.org>
COPYRIGHT
Copyright 2017 by Dana Jacobsen <dana@acm.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.