MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / CalculateInverse

Method CalculateInverse

extra/yassl/taocrypt/src/rsa.cpp:50–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49
50Integer RSA_PrivateKey::CalculateInverse(RandomNumberGenerator& rng,
51 const Integer& x) const
52{
53 ModularArithmetic modn(n_);
54
55 Integer r(rng, Integer::One(), n_ - Integer::One());
56 Integer re = modn.Exponentiate(r, e_);
57 re = modn.Multiply(re, x); // blind
58
59 // here we follow the notation of PKCS #1 and let u=q inverse mod p
60 // but in ModRoot, u=p inverse mod q, so we reverse the order of p and q
61
62 Integer y = ModularRoot(re, dq_, dp_, q_, p_, u_);
63 y = modn.Divide(y, r); // unblind
64
65 return y;
66}
67
68
69RSA_PrivateKey::RSA_PrivateKey(Source& source)

Callers 1

DecryptMethod · 0.80

Calls 3

ModularRootFunction · 0.85
ExponentiateMethod · 0.80
MultiplyMethod · 0.45

Tested by

no test coverage detected