NamedCurveFp
extends CurveFp
in package
This class is a representation of an EC over a field modulo a prime number
Important objectives for this class are:
- Does the curve contain a point?
- Comparison of two curves.
Table of Contents
Properties
- $adapter : GmpMathInterface
- $modAdapter : ModularArithmetic
- $parameters : CurveParameters
- $name : string
Methods
- __construct() : mixed
- Constructor that sets up the instance variables.
- __debugInfo() : array<string|int, mixed>
- __toString() : string
- Return string representation of curve for debugging
- cmp() : int
- Compares the curve to another.
- contains() : bool
- Checks whether the curve contains the given coordinates.
- equals() : bool
- Checks whether the curve is equal to another.
- getA() : GMP
- Returns the a parameter of the curve.
- getB() : GMP
- Returns the b parameter of the curve.
- getGenerator() : GeneratorPoint
- getInfinity() : PointInterface
- Returns a point representing infinity on the curve.
- getModAdapter() : ModularArithmetic
- Returns a modular arithmetic adapter.
- getName() : string
- getPoint() : PointInterface
- Returns the point identified by given coordinates.
- getPrime() : GMP
- Returns the prime associated with the curve.
- getSize() : int
- recoverYfromX() : GMP
Properties
$adapter
protected
GmpMathInterface
$adapter
= null
$modAdapter
protected
ModularArithmetic
$modAdapter
= null
$parameters
protected
CurveParameters
$parameters
$name
private
string
$name
Methods
__construct()
Constructor that sets up the instance variables.
public
__construct(string $name, CurveParameters $parameters, GmpMathInterface $adapter) : mixed
Parameters
- $name : string
- $parameters : CurveParameters
- $adapter : GmpMathInterface
__debugInfo()
public
__debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
Return string representation of curve for debugging
public
__toString() : string
Tags
Return values
stringcmp()
Compares the curve to another.
public
cmp(CurveFpInterface $other) : int
Parameters
- $other : CurveFpInterface
Tags
Return values
intcontains()
Checks whether the curve contains the given coordinates.
public
contains(GMP $x, GMP $y) : bool
Parameters
- $x : GMP
- $y : GMP
Tags
Return values
boolequals()
Checks whether the curve is equal to another.
public
equals(CurveFpInterface $other) : bool
Parameters
- $other : CurveFpInterface
Tags
Return values
boolgetA()
Returns the a parameter of the curve.
public
getA() : GMP
Tags
Return values
GMPgetB()
Returns the b parameter of the curve.
public
getB() : GMP
Tags
Return values
GMPgetGenerator()
public
getGenerator(GMP $x, GMP $y, GMP $order[, RandomNumberGeneratorInterface $randomGenerator = null ]) : GeneratorPoint
Parameters
- $x : GMP
- $y : GMP
- $order : GMP
- $randomGenerator : RandomNumberGeneratorInterface = null
Tags
Return values
GeneratorPointgetInfinity()
Returns a point representing infinity on the curve.
public
getInfinity() : PointInterface
Tags
Return values
PointInterfacegetModAdapter()
Returns a modular arithmetic adapter.
public
getModAdapter() : ModularArithmetic
Tags
Return values
ModularArithmeticgetName()
public
getName() : string
Return values
stringgetPoint()
Returns the point identified by given coordinates.
public
getPoint(GMP $x, GMP $y[, GMP $order = null ]) : PointInterface
Parameters
- $x : GMP
- $y : GMP
- $order : GMP = null
Tags
Return values
PointInterfacegetPrime()
Returns the prime associated with the curve.
public
getPrime() : GMP
Tags
Return values
GMPgetSize()
public
getSize() : int
Return values
intrecoverYfromX()
public
recoverYfromX(bool $wasOdd, GMP $xCoord) : GMP
Parameters
- $wasOdd : bool
- $xCoord : GMP