pycrypto rsa inverse of p modulo q
mensanator at aol.com
mensanator at aol.com
Fri Nov 4 18:03:00 EST 2005
jt wrote:
> 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 */
>
> Thx,
> --
> jt
More information about the Python-list
mailing list