| Modifier and Type | Class and Description |
|---|---|
| public static class | Primes.
Used to return the output from the Enhanced Miller-Rabin Probabilistic Primality Test |
| public static class | Primes.
Used to return the output from the Shawe-Taylor Random_Prime Routine |
| Modifier and Type | Field and Description |
|---|---|
| private static final BigInteger | |
| public static final int | |
| private static final BigInteger | |
| private static final BigInteger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public static Primes. | Returns: anMROutput instance that can be further queried for details.the candidate, SecureRandom BigInteger instance to test for primality.the source of randomness to use to choose bases. random, int the number of randomly-chosen bases to perform the test for. iterations)FIPS 186-4 C.3.2 Enhanced Miller-Rabin Probabilistic Primality Test Run several iterations of the Miller-Rabin algorithm with randomly-chosen bases. |
| private static int | |
| public static Primes. | Returns: anSTOutput instance containing the requested prime.the hash, int Digest instance to use (as "Hash()"). Cannot be null.the length (in bits) of the prime to be generated. Must be at least 2. length, byte[] the seed to be used for the generation of the requested prime. Cannot be null or
empty. inputSeed)FIPS 186-4 C.6 Shawe-Taylor Random_Prime Routine Construct a provable prime number using a hash function. |
| public static boolean | Returns: true if the candidate is found to have any small factors,
false otherwise.the candidate)BigInteger instance to test for division by small factors.A fast check for small divisors, up to some implementation-specific limit. |
| private static void | |
| private static BigInteger | |
| private static boolean | |
| private static boolean | |
| private static Primes. | |
| private static void | |
| public static boolean | Returns: false if any witness to compositeness is found amongst the chosen bases
(so candidate is definitely NOT prime), or else true
(indicating primality with some probability dependent on the number of iterations
that were performed).the candidate, SecureRandom BigInteger instance to test for primality.the source of randomness to use to choose bases. random, int the number of randomly-chosen bases to perform the test for. iterations)FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test Run several iterations of the Miller-Rabin algorithm with randomly-chosen bases. |
| public static boolean | Returns: false if the specified base is a witness to compositeness (so
candidate is definitely NOT prime), or else true.the candidate, BigInteger BigInteger instance to test for primality.the base value to use for this iteration. base)FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test (to a fixed base). |
| private static boolean |
| ONE | back to summary |
|---|---|
| private static final BigInteger ONE | |
| SMALL_FACTOR_LIMIT | back to summary |
|---|---|
| public static final int SMALL_FACTOR_LIMIT | |
| THREE | back to summary |
|---|---|
| private static final BigInteger THREE | |
| TWO | back to summary |
|---|---|
| private static final BigInteger TWO | |
| Primes | back to summary |
|---|---|
| public Primes() | |
| checkCandidate | back to summary |
|---|---|
| private static void checkCandidate(BigInteger n, String name) | |
| enhancedMRProbablePrimeTest | back to summary |
|---|---|
| public static Primes. FIPS 186-4 C.3.2 Enhanced Miller-Rabin Probabilistic Primality Test
Run several iterations of the Miller-Rabin algorithm with randomly-chosen bases. This is an
alternative to
| |
| extract32 | back to summary |
|---|---|
| private static int extract32(byte[] bs) | |
| generateSTRandomPrime | back to summary |
|---|---|
| public static Primes. FIPS 186-4 C.6 Shawe-Taylor Random_Prime Routine Construct a provable prime number using a hash function. | |
| hasAnySmallFactors | back to summary |
|---|---|
| public static boolean hasAnySmallFactors(BigInteger candidate) A fast check for small divisors, up to some implementation-specific limit.
| |
| hash | back to summary |
|---|---|
| private static void hash(Digest d, byte[] input, byte[] output, int outPos) | |
| hashGen | back to summary |
|---|---|
| private static BigInteger hashGen(Digest d, byte[] seed, int count) | |
| implHasAnySmallFactors | back to summary |
|---|---|
| private static boolean implHasAnySmallFactors(BigInteger x) | |
| implMRProbablePrimeToBase | back to summary |
|---|---|
| private static boolean implMRProbablePrimeToBase(BigInteger w, BigInteger wSubOne, BigInteger m, int a, BigInteger b) | |
| implSTRandomPrime | back to summary |
|---|---|
| private static Primes. | |
| inc | back to summary |
|---|---|
| private static void inc(byte[] seed, int c) | |
| isMRProbablePrime | back to summary |
|---|---|
| public static boolean isMRProbablePrime(BigInteger candidate, SecureRandom random, int iterations) FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test Run several iterations of the Miller-Rabin algorithm with randomly-chosen bases.
| |
| isMRProbablePrimeToBase | back to summary |
|---|---|
| public static boolean isMRProbablePrimeToBase(BigInteger candidate, BigInteger base) FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test (to a fixed base). Run a single iteration of the Miller-Rabin algorithm against the specified base.
| |
| isPrime32 | back to summary |
|---|---|
| private static boolean isPrime32(long x) | |
| Modifier and Type | Field and Description |
|---|---|
| private BigInteger | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public BigInteger | |
| public boolean | |
| public boolean | |
| private static Primes. | |
| private static Primes. | |
| private static Primes. |
| factor | back to summary |
|---|---|
| private BigInteger factor | |
| provablyComposite | back to summary |
|---|---|
| private boolean provablyComposite | |
| MROutput | back to summary |
|---|---|
| private MROutput(boolean provablyComposite, BigInteger factor) | |
| getFactor | back to summary |
|---|---|
| public BigInteger getFactor() | |
| isNotPrimePower | back to summary |
|---|---|
| public boolean isNotPrimePower() | |
| isProvablyComposite | back to summary |
|---|---|
| public boolean isProvablyComposite() | |
| probablyPrime | back to summary |
|---|---|
| private static Primes. | |
| provablyCompositeNotPrimePower | back to summary |
|---|---|
| private static Primes. | |
| provablyCompositeWithFactor | back to summary |
|---|---|
| private static Primes. | |
| Modifier and Type | Field and Description |
|---|---|
| private BigInteger | |
| private int | |
| private byte[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public BigInteger | |
| public int | |
| public byte[] |
| prime | back to summary |
|---|---|
| private BigInteger prime | |
| primeGenCounter | back to summary |
|---|---|
| private int primeGenCounter | |
| primeSeed | back to summary |
|---|---|
| private byte[] primeSeed | |
| STOutput | back to summary |
|---|---|
| private STOutput(BigInteger prime, byte[] primeSeed, int primeGenCounter) | |
| getPrime | back to summary |
|---|---|
| public BigInteger getPrime() | |
| getPrimeGenCounter | back to summary |
|---|---|
| public int getPrimeGenCounter() | |
| getPrimeSeed | back to summary |
|---|---|
| public byte[] getPrimeSeed() | |