Wednesday, 2 October 2013

Ñ# modPow negative exponent trick

Ñ# modPow negative exponent trick

I try to use using System.Numerics.BigInteger; and perfom modPow with
negative exponent, I read documentation about Exception, that's why I did
some trick
//a^(-x) mod n == (a^(-1))^x mod n
BigInteger tmp = BigInteger.ModPow(BigInteger.Divide(BigInteger.One, a),
secretKey, pCommon);
BigInteger resBigInteger = BigInteger.Multiply(b, tmp);
But tmp is 0. How I can resolve that problem?

No comments:

Post a Comment