JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Primes Class Reference

Prime number creation class. More...

#include <juce_Primes.h>

Static Public Member Functions

static BigInteger createProbablePrime (int bitLength, int certainty, const int *randomSeeds=nullptr, int numRandomSeeds=0)
 Creates a random prime number with a given bit-length. More...
 
static bool isProbablyPrime (const BigInteger &number, int certainty)
 Tests a number to see if it's prime. More...
 

Private Member Functions

 Primes ()
 

Detailed Description

Prime number creation class.

This class contains static methods for generating and testing prime numbers.

See also
BigInteger

{Cryptography}

Constructor & Destructor Documentation

◆ Primes()

juce::Primes::Primes ( )
private

Member Function Documentation

◆ createProbablePrime()

static BigInteger juce::Primes::createProbablePrime ( int  bitLength,
int  certainty,
const int randomSeeds = nullptr,
int  numRandomSeeds = 0 
)
static

Creates a random prime number with a given bit-length.

The certainty parameter specifies how many iterations to use when testing for primality. A safe value might be anything over about 20-30.

The randomSeeds parameter lets you optionally pass it a set of values with which to seed the random number generation, improving the security of the keys generated.

◆ isProbablyPrime()

static bool juce::Primes::isProbablyPrime ( const BigInteger number,
int  certainty 
)
static

Tests a number to see if it's prime.

This isn't a bulletproof test, it uses a Miller-Rabin test to determine whether the number is prime.

The certainty parameter specifies how many iterations to use when testing - a safe value might be anything over about 20-30.


The documentation for this class was generated from the following file: