10 #include "algebra.cpp" 34 bool solutionsExist = SolveModularQuadraticEquation(r1, r2, 1, -1, 1, q);
36 }
while (!p.
Randomize(rng, minP, maxP,
Integer::PRIME, CRT(rng.
GenerateBit()?r1:r2, q, 2, 3, EuclideanMultiplicativeInverse(p, 3)), 3*q));
46 t = XTR_Exponentiate(g, p+1, p);
49 g = XTR_Exponentiate(g, (p.
Squared()-p+1)/q, p);
58 unsigned int bitCount = e.BitCount();
63 unsigned int lowest1bit;
64 for (lowest1bit=0; e.GetBit(lowest1bit) == 0; lowest1bit++) {}
69 GFP2Element S[5] = {gfp2.ConvertIn(3), c, gfp2.SpecialOperation1(c)};
73 for (i = e.BitCount() - 1; i>lowest1bit; i--)
77 gfp2.RaiseToPthPower(S[0]);
78 gfp2.Accumulate(S[0], gfp2.SpecialOperation2(S[2], c, S[1]));
79 S[1] = gfp2.SpecialOperation1(S[1]);
80 S[2] = gfp2.SpecialOperation1(S[2]);
85 gfp2.RaiseToPthPower(S[2]);
86 gfp2.Accumulate(S[2], gfp2.SpecialOperation2(S[0], cp, S[1]));
87 S[1] = gfp2.SpecialOperation1(S[1]);
88 S[0] = gfp2.SpecialOperation1(S[0]);
95 S[1] = gfp2.SpecialOperation1(S[1]);
97 return gfp2.ConvertOut(S[1]);
a number which is probabilistically prime
Restricts the instantiation of a class to one static object without locks.
Interface for random number generators.
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
Classes for performing mathematics over different fields.
The XTR public key system.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Multiple precision integer with arithmetic operations.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Classes and functions for number theoretic operations.
Integer Squared() const
Multiply this integer by itself.
virtual unsigned int GenerateBit()
Generate new random bit and return it.
Multiple precision integer with arithmetic operations.
static const Integer & Zero()
Integer representing 0.
Class file for performing modular arithmetic.
Crypto++ library namespace.
GF(p^2), optimal normal basis.
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.