PointInterface
in
This is the contract for implementing Point, which encapsulates entities and operations over the points on the Elliptic Curve. Implementations must be immutable.
Implementors must be wary of the special "Infinity" implementation, which breaks LSP, and should always be checked against (and properly handled) when receiving a PointInterface as an argument or when a method indicates it can return infinity.
Tags
Table of Contents
Methods
- __toString() : string
- Returns the string representation of the point.
- add() : PointInterface
- Adds another point to the current one and returns the resulting point.
- cmp() : int
- Compares the current instance to another point.
- equals() : bool
- Checks whether the current instance is equal to the given point.
- getCurve() : CurveFpInterface
- Returns the curve to which the point belongs.
- getDouble() : PointInterface
- Doubles the current point and returns the resulting point.
- getOrder() : GMP
- Returns the order of the point.
- getX() : GMP
- Returns the X coordinate of the point.
- getY() : GMP
- Returns the Y coordinate of the point.
- isInfinity() : bool
- Returns true if instance is an non-finite point.
- mul() : PointInterface
- Multiplies the point by a scalar value and returns the resulting point.
Methods
__toString()
Returns the string representation of the point.
public
__toString() : string
Return values
stringadd()
Adds another point to the current one and returns the resulting point.
public
add(PointInterface $addend) : PointInterface
Parameters
- $addend : PointInterface
Return values
PointInterfacecmp()
Compares the current instance to another point.
public
cmp(PointInterface $other) : int
Parameters
- $other : PointInterface
Return values
int —A number different than 0 when current instance is less than the given point, 0 when they are equal.
equals()
Checks whether the current instance is equal to the given point.
public
equals(PointInterface $other) : bool
Parameters
- $other : PointInterface
Return values
bool —true when points are equal, false otherwise.
getCurve()
Returns the curve to which the point belongs.
public
getCurve() : CurveFpInterface
Return values
CurveFpInterfacegetDouble()
Doubles the current point and returns the resulting point.
public
getDouble() : PointInterface
Return values
PointInterfacegetOrder()
Returns the order of the point.
public
getOrder() : GMP
Return values
GMPgetX()
Returns the X coordinate of the point.
public
getX() : GMP
Return values
GMPgetY()
Returns the Y coordinate of the point.
public
getY() : GMP
Return values
GMPisInfinity()
Returns true if instance is an non-finite point.
public
isInfinity() : bool
Return values
boolmul()
Multiplies the point by a scalar value and returns the resulting point.
public
mul(GMP $multiplier) : PointInterface
Parameters
- $multiplier : GMP