MCPcopy Create free account
hub / github.com/LUX-Core/lux / GenerateRandom

Method GenerateRandom

src/cryptopp/rw.cpp:99–115  ·  view source on GitHub ↗

generate a random private key

Source from the content-addressed store, hash-verified

97
98// generate a random private key
99void InvertibleRWFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
100{
101 int modulusSize = 2048;
102 alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize);
103
104 if (modulusSize < 16)
105 throw InvalidArgument("InvertibleRWFunction: specified modulus length is too small");
106
107 AlgorithmParameters primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize);
108 m_p.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("EquivalentTo", 3)("Mod", 8)));
109 m_q.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("EquivalentTo", 7)("Mod", 8)));
110
111 m_n = m_p * m_q;
112 m_u = m_q.InverseMod(m_p);
113
114 Precompute();
115}
116
117void InvertibleRWFunction::Initialize(const Integer &n, const Integer &p, const Integer &q, const Integer &u)
118{

Callers 6

InitializeMethod · 0.45
InitializeMethod · 0.45
ValidateDLIESFunction · 0.45
ValidateESIGNFunction · 0.45
TestSignatureSchemeFunction · 0.45
DoTestMethod · 0.45

Calls 4

MakeParametersFunction · 0.85
InverseModMethod · 0.80
PrecomputeFunction · 0.70

Tested by 1

TestSignatureSchemeFunction · 0.36