public class GroupElement extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
GroupElement.Representation |
Modifier and Type | Field and Description |
---|---|
(package private) Curve |
curve
Variable is package private only so that tests run.
|
(package private) GroupElement[] |
dblPrecmp
Precomputed table for
doubleScalarMultiplyVariableTime(GroupElement, byte[], byte[]) ,
filled if necessary. |
(package private) GroupElement[][] |
precmp
Precomputed table for
scalarMultiply(byte[]) ,
filled if necessary. |
(package private) GroupElement.Representation |
repr
Variable is package private only so that tests run.
|
(package private) FieldElement |
T
Variable is package private only so that tests run.
|
(package private) FieldElement |
X
Variable is package private only so that tests run.
|
(package private) FieldElement |
Y
Variable is package private only so that tests run.
|
(package private) FieldElement |
Z
Variable is package private only so that tests run.
|
Constructor and Description |
---|
GroupElement(Curve curve,
byte[] s) |
GroupElement(Curve curve,
GroupElement.Representation repr,
FieldElement X,
FieldElement Y,
FieldElement Z,
FieldElement T) |
Modifier and Type | Method and Description |
---|---|
GroupElement |
add(GroupElement q)
GroupElement addition using the twisted Edwards addition law with
extended coordinates (Hisil2008).
r = p + q |
static GroupElement |
cached(Curve curve,
FieldElement YpX,
FieldElement YmX,
FieldElement Z,
FieldElement T2d) |
(package private) GroupElement |
cmov(GroupElement u,
int b)
Constant-time conditional move.
|
GroupElement |
dbl()
r = 2 * p
|
GroupElement |
doubleScalarMultiplyVariableTime(GroupElement A,
byte[] a,
byte[] b)
r = a * A + b * B where a = a[0]+256*a[1]+...+256^31 a[31],
b = b[0]+256*b[1]+...+256^31 b[31] and B is this point.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isOnCurve()
Verify that a point is on its curve.
|
boolean |
isOnCurve(Curve curve)
Verify that a point is on the curve.
|
GroupElement |
negate() |
static GroupElement |
p1p1(Curve curve,
FieldElement X,
FieldElement Y,
FieldElement Z,
FieldElement T) |
static GroupElement |
p2(Curve curve,
FieldElement X,
FieldElement Y,
FieldElement Z) |
static GroupElement |
p3(Curve curve,
FieldElement X,
FieldElement Y,
FieldElement Z,
FieldElement T) |
static GroupElement |
precomp(Curve curve,
FieldElement ypx,
FieldElement ymx,
FieldElement xy2d) |
void |
precompute(boolean precomputeSingle)
Precompute the tables for
scalarMultiply(byte[])
and doubleScalarMultiplyVariableTime(GroupElement, byte[], byte[]) . |
GroupElement |
scalarMultiply(byte[] a)
h = a * B where a = a[0]+256*a[1]+...+256^31 a[31] and
B is this point.
|
(package private) GroupElement |
select(int pos,
int b)
Look up 16^i r_i B in the precomputed table.
|
(package private) static byte[] |
slide(byte[] a)
I don't really know what this method does.
|
GroupElement |
sub(GroupElement q)
GroupElement subtraction using the twisted Edwards addition law with
extended coordinates (Hisil2008).
r = p - q |
byte[] |
toByteArray() |
GroupElement |
toCached() |
GroupElement |
toP2() |
GroupElement |
toP3() |
(package private) static byte[] |
toRadix16(byte[] a)
Convert a to radix 16.
|
String |
toString() |
final Curve curve
final GroupElement.Representation repr
final FieldElement X
final FieldElement Y
final FieldElement Z
final FieldElement T
GroupElement[][] precmp
scalarMultiply(byte[])
,
filled if necessary.
Variable is package private only so that tests run.GroupElement[] dblPrecmp
doubleScalarMultiplyVariableTime(GroupElement, byte[], byte[])
,
filled if necessary.
Variable is package private only so that tests run.public GroupElement(Curve curve, GroupElement.Representation repr, FieldElement X, FieldElement Y, FieldElement Z, FieldElement T)
public GroupElement(Curve curve, byte[] s)
public static GroupElement p2(Curve curve, FieldElement X, FieldElement Y, FieldElement Z)
public static GroupElement p3(Curve curve, FieldElement X, FieldElement Y, FieldElement Z, FieldElement T)
public static GroupElement p1p1(Curve curve, FieldElement X, FieldElement Y, FieldElement Z, FieldElement T)
public static GroupElement precomp(Curve curve, FieldElement ypx, FieldElement ymx, FieldElement xy2d)
public static GroupElement cached(Curve curve, FieldElement YpX, FieldElement YmX, FieldElement Z, FieldElement T2d)
public byte[] toByteArray()
public GroupElement toP2()
public GroupElement toP3()
public GroupElement toCached()
public void precompute(boolean precomputeSingle)
scalarMultiply(byte[])
and doubleScalarMultiplyVariableTime(GroupElement, byte[], byte[])
.precomputeSingle
- should the matrix for scalarMultiply() be precomputed?public GroupElement dbl()
public GroupElement add(GroupElement q)
q
- the CACHED representation of the GroupElement to add.public GroupElement sub(GroupElement q)
q
- the PRECOMP representation of the GroupElement to subtract.public GroupElement negate()
static byte[] toRadix16(byte[] a)
a
- = a[0]+256*a[1]+...+256^31 a[31]GroupElement cmov(GroupElement u, int b)
u
- b
- in {0, 1}GroupElement select(int pos, int b)
pos
- = i/2 for i in {0, 2, 4,..., 62}b
- = r_ipublic GroupElement scalarMultiply(byte[] a)
a
- = a[0]+256*a[1]+...+256^31 a[31]static byte[] slide(byte[] a)
a
- 32 bytespublic GroupElement doubleScalarMultiplyVariableTime(GroupElement A, byte[] a, byte[] b)
A
- in P3 representation.a
- = a[0]+256*a[1]+...+256^31 a[31]b
- = b[0]+256*b[1]+...+256^31 b[31]public boolean isOnCurve()
public boolean isOnCurve(Curve curve)
curve
- The curve to check.