21 assert(pbits > qbits);
32 CRYPTOPP_UNUSED(qFound); assert(qFound);
33 bool solutionsExist = SolveModularQuadraticEquation(r1, r2, 1, -1, 1, q);
34 CRYPTOPP_UNUSED(solutionsExist); assert(solutionsExist);
35 }
while (!p.
Randomize(rng, minP, maxP,
Integer::PRIME, CRT(rng.
GenerateBit()?r1:r2, q, 2, 3, EuclideanMultiplicativeInverse(p, 3)), 3*q));
36 assert(((p.
Squared() - p + 1) % q).IsZero());
45 t = XTR_Exponentiate(g, p+1, p);
48 g = XTR_Exponentiate(g, (p.
Squared()-p+1)/q, p);
52 assert(XTR_Exponentiate(g, q, p) == three);
57 unsigned int bitCount = e.
BitCount();
62 unsigned int lowest1bit;
63 for (lowest1bit=0; e.
GetBit(lowest1bit) == 0; lowest1bit++) {}
68 GFP2Element S[5] = {gfp2.ConvertIn(3), c, gfp2.SpecialOperation1(c)};
72 for (i = e.
BitCount() - 1; i>lowest1bit; i--)
76 gfp2.RaiseToPthPower(S[0]);
77 gfp2.Accumulate(S[0], gfp2.SpecialOperation2(S[2], c, S[1]));
78 S[1] = gfp2.SpecialOperation1(S[1]);
79 S[2] = gfp2.SpecialOperation1(S[2]);
84 gfp2.RaiseToPthPower(S[2]);
85 gfp2.Accumulate(S[2], gfp2.SpecialOperation2(S[0], cp, S[1]));
86 S[1] = gfp2.SpecialOperation1(S[1]);
87 S[0] = gfp2.SpecialOperation1(S[0]);
94 S[1] = gfp2.SpecialOperation1(S[1]);
96 return gfp2.ConvertOut(S[1]);
a number which is probabilistically prime
Restricts the instantiation of a class to one static object without locks.
bool GetBit(size_t i) const
return the i-th bit, i=0 being the least significant bit
Interface for random number generators.
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
unsigned int BitCount() const
number of significant bits = floor(log2(abs(*this))) + 1
"The XTR public key system" by Arjen K.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Multiple precision integer with arithmetic operations.
Classes and functions for number theoretic operations.
virtual unsigned int GenerateBit()
Generate new random bit and return it.
static const Integer & Zero()
Integer representing 0.
Class file for performing modular arithmetic.
Crypto++ library namespace.
GF(p^2), optimal normal basis.