Crypto++
8.6
Free C++ class library of cryptographic schemes
|
10 #include "algebra.cpp"
16 #if defined(CRYPTOPP_CXX11_STATIC_INIT)
47 }
while (((p % 3U) != 2) || (((p.
Squared() - p + 1) % q).NotZero()));
59 t = XTR_Exponentiate(g, p+1, p);
62 g = XTR_Exponentiate(g, (p.
Squared()-p+1)/q, p);
67 if (XTR_Exponentiate(g, q, p) != three)
75 unsigned int bitCount = e.
BitCount();
80 unsigned int lowest1bit;
81 for (lowest1bit=0; e.
GetBit(lowest1bit) == 0; lowest1bit++) {}
86 GFP2Element S[5] = {gfp2.ConvertIn(3), c, gfp2.SpecialOperation1(c)};
90 for (i = e.
BitCount() - 1; i>lowest1bit; i--)
94 gfp2.RaiseToPthPower(S[0]);
95 gfp2.Accumulate(S[0], gfp2.SpecialOperation2(S[2], c, S[1]));
96 S[1] = gfp2.SpecialOperation1(S[1]);
97 S[2] = gfp2.SpecialOperation1(S[2]);
102 gfp2.RaiseToPthPower(S[2]);
103 gfp2.Accumulate(S[2], gfp2.SpecialOperation2(S[0], cp, S[1]));
104 S[1] = gfp2.SpecialOperation1(S[1]);
105 S[0] = gfp2.SpecialOperation1(S[0]);
112 S[1] = gfp2.SpecialOperation1(S[1]);
114 return gfp2.ConvertOut(S[1]);
bool GetBit(size_t i) const
Provides the i-th bit of the Integer.
GF(p^2), optimal normal basis.
const T & Ref(...) const
Return a reference to the inner Singleton object.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Classes and functions for number theoretic operations.
Integer Squared() const
Multiply this integer by itself.
Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b)
Calculate multiplicative inverse.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer &q, GFP2Element &g, unsigned int pbits, unsigned int qbits)
Creates primes p,q and generator g for XTR.
CRYPTOPP_DLL Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, const Integer &q, const Integer &u)
Chinese Remainder Theorem.
The XTR public key system.
Restricts the instantiation of a class to one static object without locks.
Class file for performing modular arithmetic.
Interface for random number generators.
virtual unsigned int GenerateBit()
Generate new random bit and return it.
static const Integer & Zero()
Integer representing 0.
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
unsigned int BitCount() const
Determines the number of bits required to represent the Integer.
Classes for performing mathematics over different fields.
Crypto++ library namespace.
CRYPTOPP_DLL bool SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, const Integer &b, const Integer &c, const Integer &p)
Solve a Modular Quadratic Equation.
@ PRIME
a number which is probabilistically prime
Multiple precision integer with arithmetic operations.
Multiple precision integer with arithmetic operations.