Top Fields Constructors Methods
org.bouncycastle.math.ec

public abstract Class WNafUtil

extends Object
Class Inheritance
Imports
java.math.BigInteger

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final byte[]
private static final int[]
private static final ECPoint[]
private static final int
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
public static int[]
public static int[]
public static byte[]
public static byte[]
public static byte[]

Returns:

The Window NAF of the given width, such that the following holds: k = ∑i=0l-1 ki2i , where the ki denote the elements of the returned byte[].
generateWindowNaf
(int
The width w of the Window NAF. The width is defined as the minimal number w, such that for any w consecutive digits in the resulting representation, at most one is non-zero.
width
,
BigInteger
The integer of which the Window NAF is computed.
k
)

Computes the Window NAF (non-adjacent Form) of an integer.

public static int
public static int

Returns:

the window size to use
getWindowSize
(int
the bit-length of the scalar to multiply by
bits
)

Determine window width to use for a scalar multiplication of the given size.

public static int

Returns:

the window size to use
getWindowSize
(int
the bit-length of the scalar to multiply by
bits
,
int
the maximum window width to return
maxWidth
)

Determine window width to use for a scalar multiplication of the given size.

public static int

Returns:

the window size to use
getWindowSize
(int
the bit-length of the scalar to multiply by
bits
,
int[]
a monotonically increasing list of bit sizes at which to increment the window width
windowSizeCutoffs
)

Determine window width to use for a scalar multiplication of the given size.

public static int

Returns:

the window size to use
getWindowSize
(int
the bit-length of the scalar to multiply by
bits
,
int[]
a monotonically increasing list of bit sizes at which to increment the window width
windowSizeCutoffs
,
int
the maximum window width to return
maxWidth
)

Determine window width to use for a scalar multiplication of the given size.

public static WNafPreCompInfo
public static WNafPreCompInfo
public static WNafPreCompInfo
precompute(final ECPoint p, final int minWidth, final boolean includeNegated)

public static WNafPreCompInfo
precomputeWithPointMap(final ECPoint p, final ECPointMap pointMap, final WNafPreCompInfo fromWNaf, final boolean includeNegated)

private static ECPoint[]
resizeTable(ECPoint[] a, int length)

private static byte[]
trim(byte[] a, int length)

private static int[]
trim(int[] a, int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_WINDOW_SIZE_CUTOFFSback to summary
private static final int[] DEFAULT_WINDOW_SIZE_CUTOFFS
EMPTY_BYTESback to summary
private static final byte[] EMPTY_BYTES
EMPTY_INTSback to summary
private static final int[] EMPTY_INTS
EMPTY_POINTSback to summary
private static final ECPoint[] EMPTY_POINTS
MAX_WIDTHback to summary
private static final int MAX_WIDTH
PRECOMP_NAMEback to summary
public static final String PRECOMP_NAME

Constructor Detail

WNafUtilback to summary
public WNafUtil()

Method Detail

configureBasepointback to summary
public static void configureBasepoint(ECPoint p)
generateCompactNafback to summary
public static int[] generateCompactNaf(BigInteger k)
generateCompactWindowNafback to summary
public static int[] generateCompactWindowNaf(int width, BigInteger k)
generateJSFback to summary
public static byte[] generateJSF(BigInteger g, BigInteger h)
generateNafback to summary
public static byte[] generateNaf(BigInteger k)
generateWindowNafback to summary
public static byte[] generateWindowNaf(int width, BigInteger k)

Computes the Window NAF (non-adjacent Form) of an integer.

Parameters
width:int

The width w of the Window NAF. The width is defined as the minimal number w, such that for any w consecutive digits in the resulting representation, at most one is non-zero.

k:BigInteger

The integer of which the Window NAF is computed.

Returns:byte[]

The Window NAF of the given width, such that the following holds: k = ∑i=0l-1 ki2i , where the ki denote the elements of the returned byte[].

getNafWeightback to summary
public static int getNafWeight(BigInteger k)
getWindowSizeback to summary
public static int getWindowSize(int bits)

Determine window width to use for a scalar multiplication of the given size.

Parameters
bits:int

the bit-length of the scalar to multiply by

Returns:int

the window size to use

getWindowSizeback to summary
public static int getWindowSize(int bits, int maxWidth)

Determine window width to use for a scalar multiplication of the given size.

Parameters
bits:int

the bit-length of the scalar to multiply by

maxWidth:int

the maximum window width to return

Returns:int

the window size to use

getWindowSizeback to summary
public static int getWindowSize(int bits, int[] windowSizeCutoffs)

Determine window width to use for a scalar multiplication of the given size.

Parameters
bits:int

the bit-length of the scalar to multiply by

windowSizeCutoffs:int[]

a monotonically increasing list of bit sizes at which to increment the window width

Returns:int

the window size to use

getWindowSizeback to summary
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:int

the bit-length of the scalar to multiply by

windowSizeCutoffs:int[]

a monotonically increasing list of bit sizes at which to increment the window width

maxWidth:int

the maximum window width to return

Returns:int

the window size to use

getWNafPreCompInfoback to summary
public static WNafPreCompInfo getWNafPreCompInfo(ECPoint p)
getWNafPreCompInfoback to summary
public static WNafPreCompInfo getWNafPreCompInfo(PreCompInfo preCompInfo)
precomputeback to summary
public static WNafPreCompInfo precompute(final ECPoint p, final int minWidth, final boolean includeNegated)
precomputeWithPointMapback to summary
public static WNafPreCompInfo precomputeWithPointMap(final ECPoint p, final ECPointMap pointMap, final WNafPreCompInfo fromWNaf, final boolean includeNegated)
resizeTableback to summary
private static ECPoint[] resizeTable(ECPoint[] a, int length)
trimback to summary
private static byte[] trim(byte[] a, int length)
trimback to summary
private static int[] trim(int[] a, int length)