Documentation

PointInterface

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
todo

Fix LSP break (possibly derive an extra interface, FinitePointInterface from current one, and move coordinate-related ops to sub-interface).

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
string

cmp()

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.

getOrder()

Returns the order of the point.

public getOrder() : GMP
Return values
GMP

getX()

Returns the X coordinate of the point.

public getX() : GMP
Return values
GMP

getY()

Returns the Y coordinate of the point.

public getY() : GMP
Return values
GMP

isInfinity()

Returns true if instance is an non-finite point.

public isInfinity() : bool
Return values
bool

        
On this page

Search results