class Tnaf
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static ZTauElement[] |
alpha0
The
αu 's for a=0 as an array
of ZTauElement s. |
static byte[][] |
alpha0Tnaf
The
αu 's for a=0 as an array
of TNAFs. |
static ZTauElement[] |
alpha1
The
αu 's for a=1 as an array
of ZTauElement s. |
static byte[][] |
alpha1Tnaf
The
αu 's for a=1 as an array
of TNAFs. |
private static java.math.BigInteger |
MINUS_ONE |
private static java.math.BigInteger |
MINUS_THREE |
private static java.math.BigInteger |
MINUS_TWO |
static byte |
POW_2_WIDTH
24
|
static byte |
WIDTH
The window width of WTNAF.
|
Constructor and Description |
---|
Tnaf() |
Modifier and Type | Method and Description |
---|---|
static SimpleBigDecimal |
approximateDivisionByN(java.math.BigInteger k,
java.math.BigInteger s,
java.math.BigInteger vm,
byte a,
int m,
int c)
Approximate division by
n . |
static java.math.BigInteger[] |
getLucas(byte mu,
int k,
boolean doV)
Calculates the Lucas Sequence elements
Uk-1 and
Uk or Vk-1 and
Vk . |
static byte |
getMu(ECCurve.F2m curve)
Returns the parameter
μ of the elliptic curve. |
static ECPoint.F2m[] |
getPreComp(ECPoint.F2m p,
byte a)
Does the precomputation for WTNAF multiplication.
|
static java.math.BigInteger[] |
getSi(ECCurve.F2m curve)
Computes the auxiliary values
s0 and
s1 used for partial modular reduction. |
static java.math.BigInteger |
getTw(byte mu,
int w)
Computes the auxiliary value
tw . |
static ECPoint.F2m |
multiplyFromTnaf(ECPoint.F2m p,
byte[] u)
Multiplies a
ECPoint.F2m
by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method, given the TNAF
of λ . |
static ECPoint.F2m |
multiplyRTnaf(ECPoint.F2m p,
java.math.BigInteger k)
Multiplies a
ECPoint.F2m
by a BigInteger using the reduced τ -adic
NAF (RTNAF) method. |
static ECPoint.F2m |
multiplyTnaf(ECPoint.F2m p,
ZTauElement lambda)
Multiplies a
ECPoint.F2m
by an element λ of Z[τ]
using the τ -adic NAF (TNAF) method. |
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 ). |
static java.math.BigInteger |
norm(byte mu,
ZTauElement lambda)
Computes the norm of an element
λ of
Z[τ] . |
static ZTauElement |
partModReduction(java.math.BigInteger k,
int m,
byte a,
java.math.BigInteger[] s,
byte mu,
byte c)
Partial modular reduction modulo
(τm - 1)/(τ - 1) . |
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. |
static ECPoint.F2m |
tau(ECPoint.F2m p)
Applies the operation
τ() to an
ECPoint.F2m . |
static byte[] |
tauAdicNaf(byte mu,
ZTauElement lambda)
Computes the
τ -adic NAF (non-adjacent form) of an
element λ of Z[τ] . |
static byte[] |
tauAdicWNaf(byte mu,
ZTauElement lambda,
byte width,
java.math.BigInteger pow2w,
java.math.BigInteger tw,
ZTauElement[] alpha)
Computes the
[τ] -adic window NAF of an element
λ of Z[τ] . |
private static final java.math.BigInteger MINUS_ONE
private static final java.math.BigInteger MINUS_TWO
private static final java.math.BigInteger MINUS_THREE
public static final byte WIDTH
α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-122public static final byte POW_2_WIDTH
public static final ZTauElement[] alpha0
αu
's for a=0
as an array
of ZTauElement
s.public static final byte[][] alpha0Tnaf
αu
's for a=0
as an array
of TNAFs.public static final ZTauElement[] alpha1
αu
's for a=1
as an array
of ZTauElement
s.public static final byte[][] alpha1Tnaf
αu
's for a=1
as an array
of TNAFs.public static java.math.BigInteger norm(byte mu, ZTauElement lambda)
λ
of
Z[τ]
.mu
- The parameter μ
of the elliptic curve.lambda
- The element λ
of
Z[τ]
.λ
.public static SimpleBigDecimal norm(byte mu, SimpleBigDecimal u, SimpleBigDecimal v)
λ
of
R[τ]
, where λ = u + vτ
and u
and u
are real numbers (elements of
R
).mu
- The parameter μ
of the elliptic curve.u
- The real part of the element λ
of
R[τ]
.v
- The τ
-adic part of the element
λ
of R[τ]
.λ
.public static ZTauElement round(SimpleBigDecimal lambda0, SimpleBigDecimal lambda1, byte mu)
λ
of R[τ]
to an element of Z[τ]
, such that their difference
has minimal norm. λ
is given as
λ = λ0 + λ1τ
.lambda0
- The component λ0
.lambda1
- The component λ1
.mu
- The parameter μ
of the elliptic curve. Must
equal 1 or -1.Z[τ]
.java.lang.IllegalArgumentException
- if lambda0
and
lambda1
do not have same scale.public static SimpleBigDecimal approximateDivisionByN(java.math.BigInteger k, java.math.BigInteger s, java.math.BigInteger vm, byte a, int m, int c)
n
. For an integer
k
, the value λ = s k / n
is
computed to c
bits of accuracy.k
- The parameter k
.s
- The curve parameter s0
or
s1
.vm
- The Lucas Sequence element Vm
.a
- The parameter a
of the elliptic curve.m
- The bit length of the finite field
Fm
.c
- The number of bits of accuracy, i.e. the scale of the returned
SimpleBigDecimal
.λ = s k / n
computed to
c
bits of accuracy.public static byte[] tauAdicNaf(byte mu, ZTauElement lambda)
τ
-adic NAF (non-adjacent form) of an
element λ
of Z[τ]
.mu
- The parameter μ
of the elliptic curve.lambda
- The element λ
of
Z[τ]
.τ
-adic NAF of λ
.public static ECPoint.F2m tau(ECPoint.F2m p)
τ()
to an
ECPoint.F2m
.p
- The ECPoint.F2m to which τ()
is applied.τ(p)
public static byte getMu(ECCurve.F2m curve)
μ
of the elliptic curve.curve
- The elliptic curve from which to obtain μ
.
The curve must be a Koblitz curve, i.e. a
equals
0
or 1
and b
equals
1
.μ
of the elliptic curve.java.lang.IllegalArgumentException
- if the given ECCurve is not a Koblitz
curve.public static java.math.BigInteger[] getLucas(byte mu, int k, boolean doV)
Uk-1
and
Uk
or Vk-1
and
Vk
.mu
- The parameter μ
of the elliptic curve.k
- The index of the second element of the Lucas Sequence to be
returned.doV
- If set to true, computes Vk-1
and
Vk
, otherwise Uk-1
and
Uk
.Uk-1
and Uk
or Vk-1
and Vk
.public static java.math.BigInteger getTw(byte mu, int w)
tw
. If the width is
4, then for mu = 1
, tw = 6
and for
mu = -1
, tw = 10
mu
- The parameter μ
of the elliptic curve.w
- The window width of the WTNAF.tw
public static java.math.BigInteger[] getSi(ECCurve.F2m curve)
s0
and
s1
used for partial modular reduction.curve
- The elliptic curve for which to compute
s0
and s1
.java.lang.IllegalArgumentException
- if curve
is not a
Koblitz curve (Anomalous Binary Curve, ABC).public static ZTauElement partModReduction(java.math.BigInteger k, int m, byte a, java.math.BigInteger[] s, byte mu, byte c)
(τm - 1)/(τ - 1)
.k
- The integer to be reduced.m
- The bitlength of the underlying finite field.a
- The parameter a
of the elliptic curve.s
- The auxiliary values s0
and
s1
.mu
- The parameter μ of the elliptic curve.c
- The precision (number of bits of accuracy) of the partial
modular reduction.ρ := k partmod (τm - 1)/(τ - 1)
public static ECPoint.F2m multiplyRTnaf(ECPoint.F2m p, java.math.BigInteger k)
ECPoint.F2m
by a BigInteger
using the reduced τ
-adic
NAF (RTNAF) method.p
- The ECPoint.F2m to multiply.k
- The BigInteger
by which to multiply p
.k * p
public static ECPoint.F2m multiplyTnaf(ECPoint.F2m p, ZTauElement lambda)
ECPoint.F2m
by an element λ
of Z[τ]
using the τ
-adic NAF (TNAF) method.p
- The ECPoint.F2m to multiply.lambda
- The element λ
of
Z[τ]
.λ * p
public static ECPoint.F2m multiplyFromTnaf(ECPoint.F2m p, byte[] u)
ECPoint.F2m
by an element λ
of Z[τ]
using the τ
-adic NAF (TNAF) method, given the TNAF
of λ
.p
- The ECPoint.F2m to multiply.u
- The the TNAF of λ
..λ * p
public static byte[] tauAdicWNaf(byte mu, ZTauElement lambda, byte width, java.math.BigInteger pow2w, java.math.BigInteger tw, ZTauElement[] alpha)
[τ]
-adic window NAF of an element
λ
of Z[τ]
.mu
- The parameter μ of the elliptic curve.lambda
- The element λ
of
Z[τ]
of which to compute the
[τ]
-adic NAF.width
- The window width of the resulting WNAF.pow2w
- 2width.tw
- The auxiliary value tw
.alpha
- The αu
's for the window width.[τ]
-adic window NAF of
λ
.public static ECPoint.F2m[] getPreComp(ECPoint.F2m p, byte a)
p
- The ECPoint
for which to do the precomputation.a
- The parameter a
of the elliptic curve.p
.Copyright © 1998-2014 Gamma Technologies. All Rights Reserved.