Package org.bouncycastle.math.ec
Class WNafUtil
java.lang.Object
org.bouncycastle.math.ec.WNafUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic int[]static int[]generateCompactWindowNaf(int width, BigInteger k) static byte[]generateJSF(BigInteger g, BigInteger h) static byte[]static byte[]generateWindowNaf(int width, BigInteger k) Computes the Window NAF (non-adjacent Form) of an integer.static intstatic intgetWindowSize(int bits) Determine window width to use for a scalar multiplication of the given size.static intgetWindowSize(int bits, int maxWidth) Determine window width to use for a scalar multiplication of the given size.static intgetWindowSize(int bits, int[] windowSizeCutoffs) Determine window width to use for a scalar multiplication of the given size.static intgetWindowSize(int bits, int[] windowSizeCutoffs, int maxWidth) Determine window width to use for a scalar multiplication of the given size.static WNafPreCompInfostatic WNafPreCompInfogetWNafPreCompInfo(PreCompInfo preCompInfo) static WNafPreCompInfoprecompute(ECPoint p, int minWidth, boolean includeNegated) static WNafPreCompInfoprecomputeWithPointMap(ECPoint p, ECPointMap pointMap, WNafPreCompInfo fromWNaf, boolean includeNegated)
-
Field Details
-
PRECOMP_NAME
- See Also:
-
-
Constructor Details
-
WNafUtil
public WNafUtil()
-
-
Method Details
-
configureBasepoint
-
generateCompactNaf
-
generateCompactWindowNaf
-
generateJSF
-
generateNaf
-
generateWindowNaf
Computes the Window NAF (non-adjacent Form) of an integer.- Parameters:
width- The widthwof the Window NAF. The width is defined as the minimal numberw, such that for anywconsecutive digits in the resulting representation, at most one is non-zero.k- The integer of which the Window NAF is computed.- Returns:
- The Window NAF of the given width, such that the following holds:
k = ∑i=0l-1 ki2i, where thekidenote the elements of the returnedbyte[].
-
getNafWeight
-
getWNafPreCompInfo
-
getWNafPreCompInfo
-
getWindowSize
public static int getWindowSize(int bits) Determine window width to use for a scalar multiplication of the given size.- Parameters:
bits- the bit-length of the scalar to multiply by- Returns:
- the window size to use
-
getWindowSize
public static int getWindowSize(int bits, int maxWidth) Determine window width to use for a scalar multiplication of the given size.- Parameters:
bits- the bit-length of the scalar to multiply bymaxWidth- the maximum window width to return- Returns:
- the window size to use
-
getWindowSize
public static int getWindowSize(int bits, int[] windowSizeCutoffs) Determine window width to use for a scalar multiplication of the given size.- Parameters:
bits- the bit-length of the scalar to multiply bywindowSizeCutoffs- a monotonically increasing list of bit sizes at which to increment the window width- Returns:
- the window size to use
-
getWindowSize
public static int getWindowSize(int bits, int[] windowSizeCutoffs, int maxWidth) Determine window width to use for a scalar multiplication of the given size.- Parameters:
bits- the bit-length of the scalar to multiply bywindowSizeCutoffs- a monotonically increasing list of bit sizes at which to increment the window widthmaxWidth- the maximum window width to return- Returns:
- the window size to use
-
precompute
-
precomputeWithPointMap
public static WNafPreCompInfo precomputeWithPointMap(ECPoint p, ECPointMap pointMap, WNafPreCompInfo fromWNaf, boolean includeNegated)
-