| java.lang.Object org.bouncycastle.math.ec.Tnaf
Tnaf | class Tnaf (Code) | | Class holding methods for point multiplication based on the window
τ-adic nonadjacent form (WTNAF). The algorithms are based on the
paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves"
by Jerome A. Solinas. The paper first appeared in the Proceedings of
Crypto 1997.
|
Field Summary | |
final public static byte | POW_2_WIDTH | final public static byte | WIDTH The window width of WTNAF. | final public static ZTauElement[] | alpha0 The αu 's for a=0 as an array
of ZTauElement s. | final public static byte[][] | alpha0Tnaf The αu 's for a=0 as an array
of TNAFs. | final public static ZTauElement[] | alpha1 The αu 's for a=1 as an array
of ZTauElement s. | final public static byte[][] | alpha1Tnaf The αu 's for a=1 as an array
of TNAFs. |
Method Summary | |
public static SimpleBigDecimal | approximateDivisionByN(BigInteger k, BigInteger s, BigInteger vm, byte a, int m, int c) Approximate division by n . | public static BigInteger[] | getLucas(byte mu, int k, boolean doV) Calculates the Lucas Sequence elements Uk-1 and
Uk or Vk-1 and
Vk .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: k - The index of the second element of the Lucas Sequence to bereturned. Parameters: doV - If set to true, computes Vk-1 andVk , otherwise Uk-1 andUk . | public static byte | getMu(ECCurve.F2m curve) Returns the parameter μ of the elliptic curve.
Parameters: curve - The elliptic curve from which to obtain μ .The curve must be a Koblitz curve, i.e. | public static ECPoint.F2m[] | getPreComp(ECPoint.F2m p, byte a) Does the precomputation for WTNAF multiplication.
Parameters: p - The ECPoint for which to do the precomputation. Parameters: a - The parameter a of the elliptic curve. | public static BigInteger[] | getSi(ECCurve.F2m curve) Computes the auxiliary values s0 and
s1 used for partial modular reduction. | public static BigInteger | getTw(byte mu, int w) Computes the auxiliary value tw . | public static ECPoint.F2m | multiplyFromTnaf(ECPoint.F2m p, byte[] u) Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method, given the TNAF
of λ .
Parameters: p - The ECPoint.F2m to multiply. Parameters: u - The the TNAF of λ .. | public static ECPoint.F2m | multiplyRTnaf(ECPoint.F2m p, BigInteger k) Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by a BigInteger using the reduced τ -adic
NAF (RTNAF) method.
Parameters: p - The ECPoint.F2m to multiply. Parameters: k - The BigInteger by which to multiply p . | public static ECPoint.F2m | multiplyTnaf(ECPoint.F2m p, ZTauElement lambda) Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method.
Parameters: p - The ECPoint.F2m to multiply. Parameters: lambda - The element λ ofZ[τ] . | public static BigInteger | norm(byte mu, ZTauElement lambda) Computes the norm of an element λ of
Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] . | public static SimpleBigDecimal | norm(byte mu, SimpleBigDecimal u, SimpleBigDecimal v) Computes the norm of an element λ of
R[τ] , where λ = u + vτ
and u and u are real numbers (elements of
R ). | public static ZTauElement | partModReduction(BigInteger k, int m, byte a, BigInteger[] s, byte mu, byte c) Partial modular reduction modulo
(τm - 1)/(τ - 1) .
Parameters: k - The integer to be reduced. Parameters: m - The bitlength of the underlying finite field. Parameters: a - The parameter a of the elliptic curve. Parameters: s - The auxiliary values s0 ands1 . Parameters: mu - The parameter μ of the elliptic curve. Parameters: c - The precision (number of bits of accuracy) of the partialmodular reduction. | public static ZTauElement | round(SimpleBigDecimal lambda0, SimpleBigDecimal lambda1, byte mu) Rounds an element λ of R[τ]
to an element of Z[τ] , such that their difference
has minimal norm. | public static ECPoint.F2m | tau(ECPoint.F2m p) Applies the operation τ() to an
ECPoint.F2m . | public static byte[] | tauAdicNaf(byte mu, ZTauElement lambda) Computes the τ -adic NAF (non-adjacent form) of an
element λ of Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] . | public static byte[] | tauAdicWNaf(byte mu, ZTauElement lambda, byte width, BigInteger pow2w, BigInteger tw, ZTauElement[] alpha) Computes the [τ] -adic window NAF of an element
λ of Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] of which to compute the[τ] -adic NAF. Parameters: width - The window width of the resulting WNAF. Parameters: pow2w - 2width. Parameters: tw - The auxiliary value tw . Parameters: alpha - The αu 's for the window width. |
POW_2_WIDTH | final public static byte POW_2_WIDTH(Code) | | 24
|
WIDTH | final public static byte WIDTH(Code) | | The window width of WTNAF. The standard value of 4 is slightly less
than optimal for running time, but keeps space requirements for
precomputation low. For typical curves, a value of 5 or 6 results in
a better running time. When changing this value, the
αu 's must be computed differently, see
e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson,
Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004,
p. 121-122
|
alpha0 | final public static ZTauElement[] alpha0(Code) | | The αu 's for a=0 as an array
of ZTauElement s.
|
alpha0Tnaf | final public static byte[][] alpha0Tnaf(Code) | | The αu 's for a=0 as an array
of TNAFs.
|
alpha1 | final public static ZTauElement[] alpha1(Code) | | The αu 's for a=1 as an array
of ZTauElement s.
|
alpha1Tnaf | final public static byte[][] alpha1Tnaf(Code) | | The αu 's for a=1 as an array
of TNAFs.
|
approximateDivisionByN | public static SimpleBigDecimal approximateDivisionByN(BigInteger k, BigInteger s, BigInteger vm, byte a, int m, int c)(Code) | | Approximate division by n . For an integer
k , the value λ = s k / n is
computed to c bits of accuracy.
Parameters: k - The parameter k . Parameters: s - The curve parameter s0 ors1 . Parameters: vm - The Lucas Sequence element Vm . Parameters: a - The parameter a of the elliptic curve. Parameters: m - The bit length of the finite fieldFm . Parameters: c - The number of bits of accuracy, i.e. the scale of the returnedSimpleBigDecimal . The value λ = s k / n computed toc bits of accuracy. |
getLucas | public static BigInteger[] getLucas(byte mu, int k, boolean doV)(Code) | | Calculates the Lucas Sequence elements Uk-1 and
Uk or Vk-1 and
Vk .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: k - The index of the second element of the Lucas Sequence to bereturned. Parameters: doV - If set to true, computes Vk-1 andVk , otherwise Uk-1 andUk . An array with 2 elements, containing Uk-1 and Uk or Vk-1 and Vk . |
getMu | public static byte getMu(ECCurve.F2m curve)(Code) | | Returns the parameter μ of the elliptic curve.
Parameters: curve - The elliptic curve from which to obtain μ .The curve must be a Koblitz curve, i.e. a equals0 or 1 and b equals1 . μ of the elliptic curve. throws: IllegalArgumentException - if the given ECCurve is not a Koblitzcurve. |
getPreComp | public static ECPoint.F2m[] getPreComp(ECPoint.F2m p, byte a)(Code) | | Does the precomputation for WTNAF multiplication.
Parameters: p - The ECPoint for which to do the precomputation. Parameters: a - The parameter a of the elliptic curve. The precomputation array for p . |
getSi | public static BigInteger[] getSi(ECCurve.F2m curve)(Code) | | Computes the auxiliary values s0 and
s1 used for partial modular reduction.
Parameters: curve - The elliptic curve for which to computes0 and s1 . throws: IllegalArgumentException - if curve is not aKoblitz curve (Anomalous Binary Curve, ABC). |
getTw | public static BigInteger getTw(byte mu, int w)(Code) | | Computes the auxiliary value tw . If the width is
4, then for mu = 1 , tw = 6 and for
mu = -1 , tw = 10
Parameters: mu - The parameter μ of the elliptic curve. Parameters: w - The window width of the WTNAF. the auxiliary value tw |
multiplyFromTnaf | public static ECPoint.F2m multiplyFromTnaf(ECPoint.F2m p, byte[] u)(Code) | | Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method, given the TNAF
of λ .
Parameters: p - The ECPoint.F2m to multiply. Parameters: u - The the TNAF of λ .. λ * p |
multiplyRTnaf | public static ECPoint.F2m multiplyRTnaf(ECPoint.F2m p, BigInteger k)(Code) | | Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by a BigInteger using the reduced τ -adic
NAF (RTNAF) method.
Parameters: p - The ECPoint.F2m to multiply. Parameters: k - The BigInteger by which to multiply p . k * p |
multiplyTnaf | public static ECPoint.F2m multiplyTnaf(ECPoint.F2m p, ZTauElement lambda)(Code) | | Multiplies a
org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method.
Parameters: p - The ECPoint.F2m to multiply. Parameters: lambda - The element λ ofZ[τ] . λ * p |
norm | public static BigInteger norm(byte mu, ZTauElement lambda)(Code) | | Computes the norm of an element λ of
Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] . The norm of λ . |
norm | public static SimpleBigDecimal norm(byte mu, SimpleBigDecimal u, SimpleBigDecimal v)(Code) | | Computes the norm of an element λ of
R[τ] , where λ = u + vτ
and u and u are real numbers (elements of
R ).
Parameters: mu - The parameter μ of the elliptic curve. Parameters: u - The real part of the element λ ofR[τ] . Parameters: v - The τ -adic part of the elementλ of R[τ] . The norm of λ . |
partModReduction | public static ZTauElement partModReduction(BigInteger k, int m, byte a, BigInteger[] s, byte mu, byte c)(Code) | | Partial modular reduction modulo
(τm - 1)/(τ - 1) .
Parameters: k - The integer to be reduced. Parameters: m - The bitlength of the underlying finite field. Parameters: a - The parameter a of the elliptic curve. Parameters: s - The auxiliary values s0 ands1 . Parameters: mu - The parameter μ of the elliptic curve. Parameters: c - The precision (number of bits of accuracy) of the partialmodular reduction. ρ := k partmod (τm - 1)/(τ - 1) |
round | public static ZTauElement round(SimpleBigDecimal lambda0, SimpleBigDecimal lambda1, byte mu)(Code) | | Rounds an element λ of R[τ]
to an element of Z[τ] , such that their difference
has minimal norm. λ is given as
λ = λ0 + λ1τ .
Parameters: lambda0 - The component λ0 . Parameters: lambda1 - The component λ1 . Parameters: mu - The parameter μ of the elliptic curve. Mustequal 1 or -1. The rounded element of Z[τ] . throws: IllegalArgumentException - if lambda0 andlambda1 do not have same scale. |
tau | public static ECPoint.F2m tau(ECPoint.F2m p)(Code) | | Applies the operation τ() to an
ECPoint.F2m .
Parameters: p - The ECPoint.F2m to which τ() is applied. τ(p) |
tauAdicNaf | public static byte[] tauAdicNaf(byte mu, ZTauElement lambda)(Code) | | Computes the τ -adic NAF (non-adjacent form) of an
element λ of Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] . The τ -adic NAF of λ . |
tauAdicWNaf | public static byte[] tauAdicWNaf(byte mu, ZTauElement lambda, byte width, BigInteger pow2w, BigInteger tw, ZTauElement[] alpha)(Code) | | Computes the [τ] -adic window NAF of an element
λ of Z[τ] .
Parameters: mu - The parameter μ of the elliptic curve. Parameters: lambda - The element λ ofZ[τ] of which to compute the[τ] -adic NAF. Parameters: width - The window width of the resulting WNAF. Parameters: pow2w - 2width. Parameters: tw - The auxiliary value tw . Parameters: alpha - The αu 's for the window width. The [τ] -adic window NAF ofλ . |
|
|