Negative Exponents

Sisyphus kalinabears@iinet.net.au
Thu Sep 11 03:20:30 CEST 2003


SkyRat23@aol.com wrote:
> Hello.  I have been recently working on the Hughes variant of the Diffie-Hellman key exchange and it requires me to compute y^-1 and use this as the exponent, k=X^(y^(-1))  (y being a large randomly generated number). 

That would be Y^-1 mod n (the modular inverse of Y, mod n) ?

You can use mpz_invert() for that calculation.
See 
http://swox.com/gmp/manual/Number-Theoretic-Functions.html#Number%20Theoretic%20Functions

Cheers,
Rob




More information about the gmp-discuss mailing list