summary refs log tree commit diff
path: root/crypto/src/math/ec/multiplier/WNafUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-07 12:56:46 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-07 12:56:46 +0700
commitc89dd16807951633fce1e2e7d34858868a4ca076 (patch)
treec9fd16a709023572e008fd5ddac86d423ad82cd6 /crypto/src/math/ec/multiplier/WNafUtilities.cs
parentUpdate OCB draft references (diff)
downloadBouncyCastle.NET-ed25519-c89dd16807951633fce1e2e7d34858868a4ca076.tar.xz
Index precomputation info by name
Diffstat (limited to 'crypto/src/math/ec/multiplier/WNafUtilities.cs')
-rw-r--r--crypto/src/math/ec/multiplier/WNafUtilities.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/src/math/ec/multiplier/WNafUtilities.cs b/crypto/src/math/ec/multiplier/WNafUtilities.cs

index d37da8a5e..eac47222b 100644 --- a/crypto/src/math/ec/multiplier/WNafUtilities.cs +++ b/crypto/src/math/ec/multiplier/WNafUtilities.cs
@@ -4,6 +4,8 @@ namespace Org.BouncyCastle.Math.EC.Multiplier { public abstract class WNafUtilities { + public static readonly string PRECOMP_NAME = "bc_wnaf"; + private static int[] DEFAULT_WINDOW_SIZE_CUTOFFS = new int[]{ 13, 41, 121, 337, 897, 2305 }; public static int[] GenerateCompactNaf(BigInteger k) @@ -188,7 +190,7 @@ namespace Org.BouncyCastle.Math.EC.Multiplier * most one is non-zero. * @param k The integer of which the Window NAF is computed. * @return The Window NAF of the given width, such that the following holds: - * <code>k = &sum;<sub>i=0</sub><sup>l-1</sup> k<sub>i</sub>2<sup>i</sup> + * <code>k = &amp;sum;<sub>i=0</sub><sup>l-1</sup> k<sub>i</sub>2<sup>i</sup> * </code>, where the <code>k<sub>i</sub></code> denote the elements of the * returned <code>byte[]</code>. */ @@ -292,7 +294,7 @@ namespace Org.BouncyCastle.Math.EC.Multiplier public static WNafPreCompInfo Precompute(ECPoint p, int width, bool includeNegated) { ECCurve c = p.Curve; - WNafPreCompInfo wnafPreCompInfo = GetWNafPreCompInfo(c.GetPreCompInfo(p)); + WNafPreCompInfo wnafPreCompInfo = GetWNafPreCompInfo(c.GetPreCompInfo(p, PRECOMP_NAME)); ECPoint[] preComp = wnafPreCompInfo.PreComp; if (preComp == null) @@ -363,7 +365,7 @@ namespace Org.BouncyCastle.Math.EC.Multiplier wnafPreCompInfo.PreCompNeg = preCompNeg; } - c.SetPreCompInfo(p, wnafPreCompInfo); + c.SetPreCompInfo(p, PRECOMP_NAME, wnafPreCompInfo); return wnafPreCompInfo; }