Class EllipticCurveGroup
java.lang.Object
org.apfloat.jscience.EllipticCurveGroup
- All Implemented Interfaces:
Serializable, Immutable, Realtime, ValueType, XMLSerializable, GroupAdditive<EllipticCurveGroup>, Structure<EllipticCurveGroup>
public class EllipticCurveGroup
extends Object
implements GroupAdditive<EllipticCurveGroup>, Realtime, XMLSerializable, Serializable
This class represents a point on an elliptic curve defined over the integers modulo a modulus.
All arithmetic is done in Weierstrass form.
This class sets the modulus using ModuloApintField.setModulus(Apint).
- Since:
- 1.15.0
- Version:
- 1.15.0
- Author:
- Mikko Tommila
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEllipticCurveGroup(Apint x, Apint y) Constructs a new point on the elliptic curve. -
Method Summary
Modifier and TypeMethodDescriptioncopy()booleanstatic EllipticCurveGroupfromEdwardsPoint(Apint x, Apint y) Construct a point from twisted Edwards curve coordinates.static EllipticCurveGroupfromMontgomeryPoint(Apint x, Apint y) Construct a point from Montgomery curve coordinates.static ApintgetA()Returns the curve parameter a in Weierstrass form.static ApintgetB()Returns the curve parameter b in Weierstrass form.static ApintReturns the j-invariant of the curve.getX()Returns the x-coordinate of this point.getY()Returns the y-coordinate of this point.inthashCode()opposite()plus(EllipticCurveGroup that) static voidsetEdwardsParameters(Apint a, Apint d, Apint p) Set the curve parameters in twisted Edwards form.static voidsetMontgomeryParameters(Apint b, Apint a, Apint p) Set the curve parameters in Montgomery form.static voidsetWeierstrassParameters(Apint a, Apint b, Apint p) Set the curve parameters in Weierstrass form.Returns this elliptic curve point multiplied by a scalar.toString()toText()
-
Field Details
-
O
The "point at infinity".
-
-
Constructor Details
-
EllipticCurveGroup
-
-
Method Details
-
fromMontgomeryPoint
Construct a point from Montgomery curve coordinates. The Montgomery curve parameters must be first set withsetMontgomeryParameters(Apint, Apint, Apint).- Parameters:
x- The Montgomery curve x-coordinate.y- The Montgomery curve y-coordinate.- Returns:
- The point in Weierstrass coordinates.
-
fromEdwardsPoint
Construct a point from twisted Edwards curve coordinates. The Edwards curve parameters must be first set withsetEdwardsParameters(Apint, Apint, Apint).- Parameters:
x- The Edwards curve x-coordinate.y- The Edwards curve y-coordinate.- Returns:
- The point in Weierstrass coordinates.
-
setWeierstrassParameters
Set the curve parameters in Weierstrass form. The elliptic curve specified in the Weierstrass form is
y2 = x3 + a x + bFor example, Curve25519 can be set with
setWeierstrassParameters(new Apint(486662), new Apint(1), ApintMath.pow(new Apint(2), 255).subtract(new Apint(19)))- Parameters:
a- The curve parameter a.b- The curve parameter b.p- The modulus.
-
setMontgomeryParameters
Set the curve parameters in Montgomery form. The elliptic curve specified in the Montgomery form is
B y2 = x3 + A x2 + x For example, Curve25519 can be set withsetMontgomeryParameters(new Apint(1), new Apint(486662), ApintMath.pow(new Apint(2), 255).subtract(new Apint(19)))- Parameters:
b- The curve parameter B.a- The curve parameter A.p- The modulus.
-
setEdwardsParameters
Set the curve parameters in twisted Edwards form. The elliptic curve specified in the twisted Edwards form is
a x2 + y2 = 1 + d x2 y2 For example, Curve448 can be set withsetEdwardsParameters(new Apint(1), new Apint(-39081), ApintMath.pow(new Apint(2), 448).subtract(ApintMath.pow(new Apint(2), 224).subtract(new Apint(1))))- Parameters:
a- The curve parameter a.d- The curve parameter d.p- The modulus.
-
getA
Returns the curve parameter a in Weierstrass form.- Returns:
- The curve parameter a.
- See Also:
-
getB
Returns the curve parameter b in Weierstrass form.- Returns:
- The curve parameter b.
- See Also:
-
getJInvariant
Returns the j-invariant of the curve.- Returns:
- The j-invariant of the curve.
-
getX
-
getY
-
plus
- Specified by:
plusin interfaceGroupAdditive<EllipticCurveGroup>
-
times
Returns this elliptic curve point multiplied by a scalar.- Parameters:
that- The multiplier.- Returns:
- The resulting elliptic curve point.
-
opposite
- Specified by:
oppositein interfaceGroupAdditive<EllipticCurveGroup>
-
copy
-
toText
-
toString
-
hashCode
-
equals
-