13 #if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
14 void LUC_TestInstantiations()
26 s = (k + x*(r+e)) % q;
35 Integer Vry = publicKey.ExponentiatePublicElement((r+e)%q);
36 return (Vsg*Vsg + Vry*Vry + r*r) % p == (Vsg * Vry * r + 4) % p;
44 void DL_GroupParameters_LUC::SimultaneousExponentiate(Element *results,
const Element &base,
const Integer *exponents,
unsigned int exponentsCount)
const
46 for (
unsigned int i=0; i<exponentsCount; i++)
47 results[i] = Lucas(exponents[i], base, GetModulus());
69 return Lucas(m_e, x, m_n);
74 CRYPTOPP_UNUSED(rng), CRYPTOPP_UNUSED(level);
83 return GetValueHelper(
this, name, valueType, pValue).Assignable()
84 CRYPTOPP_GET_FUNCTION_ENTRY(Modulus)
85 CRYPTOPP_GET_FUNCTION_ENTRY(PublicExponent)
91 AssignFromHelper(
this, source)
92 CRYPTOPP_SET_FUNCTION_ENTRY(Modulus)
93 CRYPTOPP_SET_FUNCTION_ENTRY(PublicExponent)
104 bool IsAcceptable(
const Integer &candidate)
const
106 return RelativelyPrime(m_e, candidate+1) && RelativelyPrime(m_e, candidate-1);
113 int modulusSize = 2048;
116 if (modulusSize < 16)
117 throw InvalidArgument(
"InvertibleLUCFunction: specified modulus size is too small");
121 if (m_e < 5 || m_e.IsEven())
122 throw InvalidArgument(
"InvertibleLUCFunction: invalid public exponent");
126 (
"PointerToPrimeSelector", selector.GetSelectorPointer());
127 m_p.GenerateRandom(rng, primeParam);
128 m_q.GenerateRandom(rng, primeParam);
159 const byte version[] = {INTEGER, 1, 0};
160 seq.Put(version,
sizeof(version));
172 CRYPTOPP_UNUSED(rng);
174 return InverseLucas(m_e, x, m_q, m_p, m_u);
185 pass = pass && m_p * m_q == m_n;
186 pass = pass && RelativelyPrime(m_e, m_p+1);
187 pass = pass && RelativelyPrime(m_e, m_p-1);
188 pass = pass && RelativelyPrime(m_e, m_q+1);
189 pass = pass && RelativelyPrime(m_e, m_q-1);
190 pass = pass && m_u * m_q % m_p == 1;
199 return GetValueHelper<LUCFunction>(
this, name, valueType, pValue).Assignable()
200 CRYPTOPP_GET_FUNCTION_ENTRY(Prime1)
201 CRYPTOPP_GET_FUNCTION_ENTRY(Prime2)
202 CRYPTOPP_GET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1)
208 AssignFromHelper<LUCFunction>(
this, source)
209 CRYPTOPP_SET_FUNCTION_ENTRY(Prime1)
210 CRYPTOPP_SET_FUNCTION_ENTRY(Prime2)
211 CRYPTOPP_SET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1)