6#ifndef CRYPTOPP_NBTHEORY_H
7#define CRYPTOPP_NBTHEORY_H
13NAMESPACE_BEGIN(CryptoPP)
117 const PrimeSelector *GetSelectorPointer()
const {
return this;}
118 virtual bool IsAcceptable(
const Integer &candidate)
const =0;
133CRYPTOPP_DLL
unsigned int CRYPTOPP_API PrimeSearchInterval(
const Integer &max);
135CRYPTOPP_DLL
AlgorithmParameters CRYPTOPP_API MakeParametersForTwoPrimesOfEqualSize(
unsigned int productBitLength);
167 {
return a.InverseMod(b);}
209 {
return a_times_b_mod_c(x, y, m);}
217 {
return a_exp_b_mod_c(x, e, m);}
278 {Generate(delta, rng, pbits, pbits-1);}
289 {Generate(delta, rng, pbits, qbits);}
Classes for working with NameValuePairs.
An object that implements NameValuePairs.
Multiple precision integer with arithmetic operations.
static Integer CRYPTOPP_API Gcd(const Integer &a, const Integer &n)
Calculate greatest common divisor.
static const Integer &CRYPTOPP_API One()
Integer representing 1.
Generator of prime numbers of special forms.
const Integer & SubPrime() const
Retrieve second prime.
PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits)
Construct a PrimeAndGenerator.
PrimeAndGenerator()
Construct a PrimeAndGenerator.
const Integer & Generator() const
Retrieve the generator.
const Integer & Prime() const
Retrieve first prime.
PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits)
Construct a PrimeAndGenerator.
Application callback to signal suitability of a cabdidate prime.
Interface for random number generators.
unsigned short word16
16-bit unsigned datatype
Abstract base classes that provide a uniform interface to this library.
Multiple precision integer with arithmetic operations.
CRYPTOPP_DLL bool CRYPTOPP_API IsStrongLucasProbablePrime(const Integer &n)
Determine if a number is probably prime.
bool RelativelyPrime(const Integer &a, const Integer &b)
Determine relative primality.
Integer ModularMultiplication(const Integer &x, const Integer &y, const Integer &m)
Modular multiplication.
CRYPTOPP_DLL bool CRYPTOPP_API RabinMillerTest(RandomNumberGenerator &rng, const Integer &n, unsigned int rounds)
Determine if a number is probably prime.
CRYPTOPP_DLL unsigned int CRYPTOPP_API DiscreteLogWorkFactor(unsigned int bitlength)
Estimate work factor.
CRYPTOPP_DLL unsigned int CRYPTOPP_API FactoringWorkFactor(unsigned int bitlength)
Estimate work factor.
CRYPTOPP_DLL Integer CRYPTOPP_API ModularSquareRoot(const Integer &a, const Integer &p)
Extract a modular square root.
CRYPTOPP_DLL bool CRYPTOPP_API IsStrongProbablePrime(const Integer &n, const Integer &b)
Determine if a number is probably prime.
Integer ModularExponentiation(const Integer &x, const Integer &e, const Integer &m)
Modular exponentiation.
CRYPTOPP_DLL Integer CRYPTOPP_API InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u)
Calculate the inverse Lucas value.
CRYPTOPP_DLL Integer CRYPTOPP_API Lucas(const Integer &e, const Integer &p, const Integer &n)
Calculate the Lucas value.
CRYPTOPP_DLL bool CRYPTOPP_API SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, const Integer &b, const Integer &c, const Integer &p)
Solve a Modular Quadratic Equation.
CRYPTOPP_DLL Integer CRYPTOPP_API CRT(const Integer &xp, const Integer &p, const Integer &xq, const Integer &q, const Integer &u)
Chinese Remainder Theorem.
CRYPTOPP_DLL bool CRYPTOPP_API IsPrime(const Integer &p)
Verifies a number is probably prime.
CRYPTOPP_DLL bool CRYPTOPP_API IsFermatProbablePrime(const Integer &n, const Integer &b)
Determine if a number is probably prime.
CRYPTOPP_DLL bool CRYPTOPP_API FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Integer &mod, const PrimeSelector *pSelector)
Finds a random prime of special form.
Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b)
Calculate multiplicative inverse.
CRYPTOPP_DLL bool CRYPTOPP_API VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level=1)
Verifies a number is probably prime.
CRYPTOPP_DLL bool CRYPTOPP_API IsLucasProbablePrime(const Integer &n)
Determine if a number is probably prime.
CRYPTOPP_DLL Integer CRYPTOPP_API MihailescuProvablePrime(RandomNumberGenerator &rng, unsigned int bits)
Generates a provable prime.
CRYPTOPP_DLL bool CRYPTOPP_API IsSmallPrime(const Integer &p)
Tests whether a number is a small prime.
CRYPTOPP_DLL bool CRYPTOPP_API TrialDivision(const Integer &p, unsigned bound)
Tests whether a number is divisible by a small prime.
CRYPTOPP_DLL int CRYPTOPP_API Jacobi(const Integer &a, const Integer &b)
Calculate the Jacobi symbol.
Integer GCD(const Integer &a, const Integer &b)
Calculate the greatest common divisor.
CRYPTOPP_DLL Integer CRYPTOPP_API MaurerProvablePrime(RandomNumberGenerator &rng, unsigned int bits)
Generates a provable prime.
CRYPTOPP_DLL const word16 *CRYPTOPP_API GetPrimeTable(unsigned int &size)
The Small Prime table.
CRYPTOPP_DLL bool CRYPTOPP_API SmallDivisorsTest(const Integer &p)
Tests whether a number is divisible by a small prime.
Integer LCM(const Integer &a, const Integer &b)
Calculate the least common multiple.
CRYPTOPP_DLL Integer CRYPTOPP_API ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, const Integer &p, const Integer &q, const Integer &u)
Extract a modular root.