diff options
Diffstat (limited to 'crypto/src/math/BigInteger.cs')
-rw-r--r-- | crypto/src/math/BigInteger.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs index 42b5b5089..e5ab22e92 100644 --- a/crypto/src/math/BigInteger.cs +++ b/crypto/src/math/BigInteger.cs @@ -1719,6 +1719,8 @@ namespace Org.BouncyCastle.Math return (biggie.sign >= 0 ? biggie : biggie.Add(m)); } + public BigInteger ModDivide(BigInteger y, BigInteger m) => ModMultiply(y.ModInverse(m), m); + public BigInteger ModInverse( BigInteger m) { @@ -1875,6 +1877,10 @@ namespace Org.BouncyCastle.Math Array.Clear(x, 0, x.Length); } + public BigInteger ModMultiply(BigInteger y, BigInteger m) => Multiply(y).Mod(m); + + public BigInteger ModSquare(BigInteger m) => Square().Mod(m); + public BigInteger ModPow(BigInteger e, BigInteger m) { if (m.sign < 1) |