From 4b5cf5479807fc2652888be79fca4ab659662306 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 12 Mar 2014 18:13:12 +0700 Subject: All subclasses to control the choice of width to use --- crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crypto') diff --git a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs index 48ce4a56c..e3da3f7c2 100644 --- a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs +++ b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs @@ -21,8 +21,7 @@ namespace Org.BouncyCastle.Math.EC.Multiplier throw new InvalidOperationException("fixed-point comb doesn't support scalars larger than the curve order"); } - // TODO Call method to let subclasses select width - int width = size > 257 ? 6 : 5; + int width = GetWidthForCombSize(size); FixedPointPreCompInfo info = FixedPointUtilities.Precompute(p, width); ECPoint[] lookupTable = info.PreComp; @@ -50,5 +49,10 @@ namespace Org.BouncyCastle.Math.EC.Multiplier return R; } + + protected virtual int GetWidthForCombSize(int combSize) + { + return combSize > 257 ? 6 : 5; + } } } -- cgit 1.5.1