<PackageReference Include="BouncyCastle.Cryptography" Version="2.1.0" />

Primes

public static class Primes
Utility methods for generating primes and testing for primality.
public sealed class MROutput

Used to return the output from the EnhancedMRProbablePrimeTestEnhanced Miller-Rabin Probabilistic Primality Test

public sealed class STOutput

Used to return the output from the GenerateSTRandomPrimeShawe-Taylor Random_Prime Routine

public static readonly int SmallFactorLimit

public static MROutput EnhancedMRProbablePrimeTest(BigInteger candidate, SecureRandom random, int iterations)

FIPS 186-4 C.3.2 Enhanced Miller-Rabin Probabilistic Primality Test.

public static STOutput GenerateSTRandomPrime(IDigest hash, int length, byte[] inputSeed)

FIPS 186-4 C.6 Shawe-Taylor Random_Prime Routine.

public static bool HasAnySmallFactors(BigInteger candidate)

A fast check for small divisors, up to some implementation-specific limit.

public static bool IsMRProbablePrime(BigInteger candidate, SecureRandom random, int iterations)

FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test.

public static bool IsMRProbablePrimeToBase(BigInteger candidate, BigInteger baseValue)

FIPS 186-4 C.3.1 Miller-Rabin Probabilistic Primality Test (to a fixed base).