3 #ifndef CRYPTOPP_NBTHEORY_H
4 #define CRYPTOPP_NBTHEORY_H
9 NAMESPACE_BEGIN(CryptoPP)
12 CRYPTOPP_DLL const word16 * CRYPTOPP_API GetPrimeTable(
unsigned int &size);
20 CRYPTOPP_DLL
bool CRYPTOPP_API IsSmallPrime(const
Integer &p);
24 CRYPTOPP_DLL
bool CRYPTOPP_API TrialDivision(const
Integer &p,
unsigned bound);
27 CRYPTOPP_DLL
bool CRYPTOPP_API SmallDivisorsTest(const
Integer &p);
30 CRYPTOPP_DLL
bool CRYPTOPP_API IsFermatProbablePrime(const
Integer &n, const
Integer &b);
31 CRYPTOPP_DLL
bool CRYPTOPP_API IsLucasProbablePrime(const
Integer &n);
33 CRYPTOPP_DLL
bool CRYPTOPP_API IsStrongProbablePrime(const
Integer &n, const
Integer &b);
34 CRYPTOPP_DLL
bool CRYPTOPP_API IsStrongLucasProbablePrime(const
Integer &n);
41 CRYPTOPP_DLL
bool CRYPTOPP_API IsPrime(const
Integer &p);
49 const PrimeSelector *GetSelectorPointer()
const {
return this;}
50 virtual bool IsAcceptable(
const Integer &candidate)
const =0;
57 CRYPTOPP_DLL
unsigned int CRYPTOPP_API PrimeSearchInterval(
const Integer &max);
59 CRYPTOPP_DLL
AlgorithmParameters CRYPTOPP_API MakeParametersForTwoPrimesOfEqualSize(
unsigned int productBitLength);
77 CRYPTOPP_DLL
int CRYPTOPP_API Jacobi(
const Integer &a,
const Integer &b);
85 {
return a_exp_b_mod_c(a, e, m);}
99 CRYPTOPP_DLL
unsigned int CRYPTOPP_API DiscreteLogWorkFactor(
unsigned int bitlength);
100 CRYPTOPP_DLL
unsigned int CRYPTOPP_API FactoringWorkFactor(
unsigned int bitlength);
113 {Generate(delta, rng, pbits, pbits-1);}
117 {Generate(delta, rng, pbits, qbits);}
121 const Integer& Prime()
const {
return p;}
122 const Integer& SubPrime()
const {
return q;}
123 const Integer& Generator()
const {
return g;}
static const Integer & One()
avoid calling constructors for these frequently used integers
static Integer Gcd(const Integer &a, const Integer &n)
greatest common divisor
interface for random number generators
generator of prime numbers of special forms
multiple precision integer and basic arithmetics
Integer InverseMod(const Integer &n) const
calculate multiplicative inverse of *this mod n