Documentation

Point
in package
implements PointInterface

This class is where the elliptic curve arithmetic takes place.

The important methods are:

  • add: adds two points according to ec arithmetic
  • double: doubles a point on the ec field mod p
  • mul: uses double and add to achieve multiplication The rest of the methods are there for supporting the ones above.

Table of Contents

Interfaces

PointInterface
This is the contract for implementing Point, which encapsulates entities and operations over the points on the Elliptic Curve. Implementations must be immutable.

Properties

$adapter  : GmpMathInterface
$curve  : CurveFpInterface
$infinity  : bool
$modAdapter  : ModularArithmetic
$order  : GMP
$windowSize  : int
$x  : GMP
$y  : GMP

Methods

__construct()  : mixed
Initialize a new instance.
__debugInfo()  : array<string|int, mixed>
__toString()  : string
Returns the string representation of the point.
add()  : self
Adds another point to the current one and returns the resulting point.
cmp()  : int
Compares the current instance to another point.
cswapValue()  : mixed
equals()  : bool
Checks whether the current instance is equal to the given point.
getAdapter()  : GmpMathInterface
getCurve()  : CurveFpInterface
Returns the curve to which the point belongs.
getDouble()  : self
Doubles the current point and returns the resulting point.
getOrder()  : GMP
Returns the order of the point.
getWindowSize()  : int
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.
setWindowSize()  : self
cswap()  : mixed
validate()  : mixed

Properties

$infinity

private bool $infinity = false

$windowSize

private int $windowSize

Methods

__construct()

Initialize a new instance.

public __construct(GmpMathInterface $adapter, CurveFpInterface $curve, GMP $x, GMP $y[, GMP $order = null ][, bool $infinity = false ]) : mixed
Parameters
$adapter : GmpMathInterface
$curve : CurveFpInterface
$x : GMP
$y : GMP
$order : GMP = null
$infinity : bool = false
Tags
throws
RuntimeException

when either the curve does not contain the given coordinates or when order is not null and P(x, y) * order is not equal to infinity

__debugInfo()

public __debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

cmp()

Compares the current instance to another point.

public cmp(PointInterface $other) : int
Parameters
$other : PointInterface
Tags
see
PointInterface::cmp()
Return values
int

A number different than 0 when current instance is less than the given point, 0 when they are equal.

cswapValue()

public cswapValue(bool|GMP &$a, bool|GMP &$b, int $cond, int $maskBitSize) : mixed
Parameters
$a : bool|GMP
$b : bool|GMP
$cond : int
$maskBitSize : int

getWindowSize()

public getWindowSize() : int
Return values
int

setWindowSize()

public setWindowSize(int $n) : self
Parameters
$n : int
Return values
self

cswap()

private cswap(self $a, self $b, int $cond, int $curveSize) : mixed
Parameters
$a : self
$b : self
$cond : int
$curveSize : int

validate()

private validate() : mixed

        
On this page

Search results