|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--de.flexiprovider.common.math.ellipticcurves.Point
|
+--de.flexiprovider.common.math.ellipticcurves.PointGF2n
This class implements points and their arithmetic on elliptic curves over finite fields with characteristic 2 (GF(2n)). A Point P = (x, y) is the tupel x, y that solves the equation y2 + xy = x3 + ax2 + b, x and y in GF(2n).
Points on elliptic curves can be added and subtracted. Since each of these
operations require a field inversion in GF(2n), which is
expensive, this class calculates with projective coordinates to avoid these
inversions. The equation for the elliptic curve is as follows:
Y2Z6 + XYZ5 = X3Z6 +
aX2Z4 + b,
with x = X/Z2 and y = Y/Z3.
For the formulas of the projective addition and doubling
add and multiplyBy2, respectively.
EllipticCurveGF2n,
Point,
GF2nField,
GF2nElement| Fields inherited from class de.flexiprovider.common.math.ellipticcurves.Point |
ENCODING_TYPE_COMPRESSED, ENCODING_TYPE_HYBRID, ENCODING_TYPE_UNCOMPRESSED, mE, mP |
| Constructor Summary | |
PointGF2n(byte[] encoded,
EllipticCurveGF2n E)
Constructs a new point. |
|
PointGF2n(EllipticCurveGF2n E)
Construct the point at infinity on the specified elliptic curve |
|
PointGF2n(EllipticCurveGF2n E,
java.util.Random rand)
Construct a random point on the specified elliptic curve using the given source of randomness. |
|
PointGF2n(GF2nElement x,
GF2nElement y,
EllipticCurveGF2n E)
Constructs point with specified parameters. |
|
PointGF2n(GF2nElement x,
GF2nElement y,
GF2nElement z,
EllipticCurveGF2n E)
Constructs point with specified parameters. |
|
PointGF2n(PointGF2n other)
Copy constructor. |
|
| Method Summary | |
Point |
add(Point other)
Adds to this point the point other. |
Point |
addAffine(Point other)
Adds in affine coordinates to this point the point other. |
void |
addToThis(Point other)
Adds to this point the point other. |
java.lang.Object |
clone()
|
(package private) byte[] |
encodeCompressed()
Returns this point in affine, compressed form as a byte array. |
(package private) byte[] |
encodeHybrid()
Returns this point in affine, hybrid form as a byte array. |
(package private) byte[] |
encodeUncompressed()
Returns this point in affine, decompressed form as a byte array. |
boolean |
equals(java.lang.Object other)
Tests whether this point is equal to other. |
Point |
getAffin()
Returns this point with affin coordinates. |
GFElement |
getX()
|
GFElement |
getXAffin()
Return the x-coordinate of this point in affine representation. |
GFElement |
getY()
|
GFElement |
getYAffin()
Return the y-coordinate of this point in affine representation. |
GFElement |
getZ()
|
int |
hashCode()
|
boolean |
isZero()
Tests, whether this point is at infinity. |
Point |
multiplyBy2()
Doubles this point. |
Point |
multiplyBy2Affine()
Doubles this point in affine coordinates. |
void |
multiplyThisBy2()
Doubles this point. |
Point |
negate()
Returns the inverse of this point. |
void |
negateThis()
Negates this PointGF2n. |
boolean |
onCurve()
Tests whether this point is on the curve mE. |
Point |
subtract(Point other)
Subtracts point other from this point. |
void |
subtractFromThis(Point other)
Subtracts point other from this point. |
java.lang.String |
toString()
Returns this point in affine representation as a String: (x, y), where x = mX/mZ2 and y = mZ/mZ3. |
| Methods inherited from class de.flexiprovider.common.math.ellipticcurves.Point |
EC2OSP, getE, isNegativeOf, OS2ECP |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public PointGF2n(EllipticCurveGF2n E)
E - the elliptic curve this point lies on
public PointGF2n(EllipticCurveGF2n E,
java.util.Random rand)
E - the elliptic curve this point lies onrand - the source of randomness
public PointGF2n(GF2nElement x,
GF2nElement y,
EllipticCurveGF2n E)
throws InvalidPointException,
DifferentFieldsException
x - x-coordinatey - y-coordinateE - EllipticCurveGF2n is the elliptic curve this point lies onInvalidPointException - if the specified point is not on the curve.DifferentFieldsException - if x and y are defined over
different fields.
public PointGF2n(GF2nElement x,
GF2nElement y,
GF2nElement z,
EllipticCurveGF2n E)
throws InvalidPointException,
DifferentFieldsException
x - x-coordinatey - y-coordinatez - z-coordinateE - the elliptic curve this point lies onInvalidPointException - if the specified point is not on the curve.DifferentFieldsException - if x, y, and z are
defined over different fields.
public PointGF2n(byte[] encoded,
EllipticCurveGF2n E)
throws InvalidPointException,
InvalidFormatException
encoded - the point in normal, compressed or hybrid form.E - the underlying elliptic curveInvalidPointException - if the point is not on the curve.InvalidFormatException - if the point representation is invalid.public PointGF2n(PointGF2n other)
other - point to copy| Method Detail |
public java.lang.Object clone()
clone in class Pointpublic boolean equals(java.lang.Object other)
equals in class Pointother - point to compare this point withpublic int hashCode()
hashCode in class PointObject.hashCode()public java.lang.String toString()
toString in class java.lang.Objectpublic GFElement getX()
getX in class Pointpublic GFElement getY()
getY in class Pointpublic GFElement getZ()
getZ in class Pointpublic GFElement getXAffin()
getXAffin in class Pointpublic GFElement getYAffin()
getYAffin in class Pointpublic Point getAffin()
PointgetAffin in class Pointpublic boolean onCurve()
onCurve in class PointEllipticCurveGF2npublic boolean isZero()
PointisZero in class Point
public Point add(Point other)
throws DifferentCurvesException
add in class Pointother - point to add to this pointDifferentCurvesException - if this and other are not on the
same curve.
public void addToThis(Point other)
throws DifferentCurvesException
addToThis in class Pointother - point to add to this pointDifferentCurvesException - if this and other are not on the
same curve.public Point addAffine(Point other)
other.addAffine in class Pointother - point to add to this pointthis + other in affine coordinatesDifferentCurvesException - when other is defined over another
curvepublic Point multiplyBy2()
multiplyBy2 in class Pointpublic void multiplyThisBy2()
multiplyThisBy2 in class Pointpublic Point multiplyBy2Affine()
multiplyBy2Affine in class Pointthis in affine coordinates
public Point subtract(Point other)
throws DifferentCurvesException
subtract in class Pointother - another PointDifferentCurvesException - if this and other are not on the
same curve.
public void subtractFromThis(Point other)
throws DifferentCurvesException
subtractFromThis in class Pointother - another PointDifferentCurvesException - if this and other are not on the
same curve.public Point negate()
negate in class Pointpublic void negateThis()
negateThis in class Pointbyte[] encodeUncompressed()
encodeUncompressed in class Pointbyte[] encodeCompressed()
encodeCompressed in class Pointbyte[] encodeHybrid()
encodeHybrid in class Point
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||