summary refs log tree commit diff
path: root/crypto/src/math/ec/abc/Tnaf.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-01-04 13:56:40 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-01-04 13:56:40 +0700
commitd9a600384ea457c1117ac900c9e1ca3d164448f8 (patch)
tree8e6caccf0880b799a7513b4fa782dc4fdc380b87 /crypto/src/math/ec/abc/Tnaf.cs
parentRefactoring around Asn1TaggedObject (diff)
downloadBouncyCastle.NET-ed25519-d9a600384ea457c1117ac900c9e1ca3d164448f8.tar.xz
Add some convenience methods to BigInteger
Diffstat (limited to '')
-rw-r--r--crypto/src/math/ec/abc/Tnaf.cs4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/src/math/ec/abc/Tnaf.cs b/crypto/src/math/ec/abc/Tnaf.cs
index d8e9b6ae0..3707a974a 100644
--- a/crypto/src/math/ec/abc/Tnaf.cs
+++ b/crypto/src/math/ec/abc/Tnaf.cs
@@ -512,9 +512,7 @@ namespace Org.BouncyCastle.Math.EC.Abc
             {
                 // For w <> 4, the values must be computed
                 BigInteger[] us = GetLucas(mu, w, false);
-                BigInteger twoToW = BigInteger.Zero.SetBit(w);
-                BigInteger u1invert = us[1].ModInverse(twoToW);
-                return us[0].ShiftLeft(1).Multiply(u1invert).Mod(twoToW);
+                return us[0].ShiftLeft(1).ModDivide(us[1], BigInteger.One.ShiftLeft(w));
             }
         }