pycrypto rsa inverse of p modulo q

J

jt

Looking up into Crypto.PublicKey.RSA, I see there is a computed value
named "u" for which I can't see the use. The value of "u" is the
inverse of p modulo q, in the code:
obj.u = pubkey.inverse(obj.p, obj.q)
Can someone tell me where this value could be used in the RSA scheme?
(it is not used in the code anyway)

Thx,
 
M

mensanator

jt said:
Looking up into Crypto.PublicKey.RSA, I see there is a computed value
named "u" for which I can't see the use. The value of "u" is the
inverse of p modulo q, in the code:
obj.u = pubkey.inverse(obj.p, obj.q)
Can someone tell me where this value could be used in the RSA scheme?
(it is not used in the code anyway)

Yes, it is. Look in _fastmath.c. It's used in rsaDecrypt:

/* fast path */
/* m1 = c ^ (d mod (p-1)) mod p */
/* m2 = c ^ (d mod (q-1)) mod q */
/* h = u * ( m2 - m1 ) mod q */ <-- right here
/* m = m2 + h * p */
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top