nistk163
extends sect163k1
in package
Curves over y^2 + x*y = x^3 + a*x^2 + b
Table of Contents
Properties
- $a : object
- Cofficient for x^1
- $b : object
- Cofficient for x^0
- $doubles : array<string|int, object>
- Doubles
- $factory : BinaryField
- Binary Field Integer factory
- $modulo : BigInteger
- The modulo
- $one : object
- The number one over the specified finite field
- $order : BigInteger
- The Order
- $p : object
- Base Point
- $naf : array<string|int, int>
- NAF Points
Methods
- __construct() : mixed
- addPoint() : array<string|int, FiniteField>
- Adds two points on the curve
- convertInteger() : object
- Converts a BigInteger to a FiniteField integer
- convertToAffine() : array<string|int, Integer>
- Returns the affine point
- convertToInternal() : array<string|int, Integer>
- Converts an affine point to a jacobian coordinate
- createRandomMultiplier() : FiniteField
- Creates a random scalar multiplier
- derivePoint() : array<string|int, mixed>
- Returns the X coordinate and the derived Y coordinate
- doublePoint() : array<string|int, FiniteField>
- Doubles a point on a curve
- getA() : Integer
- Returns the a coefficient
- getB() : Integer
- Returns the a coefficient
- getBasePoint() : array<string|int, mixed>
- Retrieve the base point as an array
- getLength() : int
- Returns the length, in bits, of the modulo
- getLengthInBytes() : int
- Returns the length, in bytes, of the modulo
- getModulo() : BigInteger
- Returns the modulo
- getOrder() : BigInteger
- Returns the Order
- multiplyAddPoints() : array<string|int, int>
- Multiply and Add Points
- multiplyPoint() : array<string|int, mixed>
- Multiply a point on the curve by a scalar
- negatePoint() : array<string|int, object>
- Negates a point
- randomInteger() : object
- Returns a random integer
- setBasePoint() : mixed
- Set x and y coordinates for the base point
- setCoefficients() : mixed
- Set coefficients a and b
- setModulo() : mixed
- Sets the modulo
- setOrder() : mixed
- Sets the Order
- setReduction() : object
- Use a custom defined modular reduction function
- verifyPoint() : bool
- Tests whether or not the x / y values satisfy the equation
Properties
$a
Cofficient for x^1
protected
object
$a
$b
Cofficient for x^0
protected
object
$b
$doubles
Doubles
protected
array<string|int, object>
$doubles
$factory
Binary Field Integer factory
protected
BinaryField
$factory
$modulo
The modulo
protected
BigInteger
$modulo
$one
The number one over the specified finite field
protected
object
$one
$order
The Order
protected
BigInteger
$order
$p
Base Point
protected
object
$p
$naf
NAF Points
private
array<string|int, int>
$naf
Methods
__construct()
public
__construct() : mixed
addPoint()
Adds two points on the curve
public
addPoint(array<string|int, mixed> $p, array<string|int, mixed> $q) : array<string|int, FiniteField>
Parameters
- $p : array<string|int, mixed>
- $q : array<string|int, mixed>
Return values
array<string|int, FiniteField>convertInteger()
Converts a BigInteger to a FiniteField integer
public
convertInteger(BigInteger $x) : object
Parameters
- $x : BigInteger
Return values
objectconvertToAffine()
Returns the affine point
public
convertToAffine(array<string|int, mixed> $p) : array<string|int, Integer>
A Jacobian Coordinate is of the form (x, y, z). To convert a Jacobian Coordinate to an Affine Point you do (x / z^2, y / z^3)
Parameters
- $p : array<string|int, mixed>
Return values
array<string|int, Integer>convertToInternal()
Converts an affine point to a jacobian coordinate
public
convertToInternal(array<string|int, mixed> $p) : array<string|int, Integer>
Parameters
- $p : array<string|int, mixed>
Return values
array<string|int, Integer>createRandomMultiplier()
Creates a random scalar multiplier
public
createRandomMultiplier() : FiniteField
Return values
FiniteFieldderivePoint()
Returns the X coordinate and the derived Y coordinate
public
derivePoint(mixed $m) : array<string|int, mixed>
Not supported because it is covered by patents. Quoting https://www.openssl.org/docs/man1.1.0/apps/ecparam.html ,
"Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time."
Parameters
- $m : mixed
Return values
array<string|int, mixed>doublePoint()
Doubles a point on a curve
public
doublePoint(array<string|int, mixed> $p) : array<string|int, FiniteField>
Parameters
- $p : array<string|int, mixed>
Return values
array<string|int, FiniteField>getA()
Returns the a coefficient
public
getA() : Integer
Return values
IntegergetB()
Returns the a coefficient
public
getB() : Integer
Return values
IntegergetBasePoint()
Retrieve the base point as an array
public
getBasePoint() : array<string|int, mixed>
Return values
array<string|int, mixed>getLength()
Returns the length, in bits, of the modulo
public
getLength() : int
Return values
intgetLengthInBytes()
Returns the length, in bytes, of the modulo
public
getLengthInBytes() : int
Return values
intgetModulo()
Returns the modulo
public
getModulo() : BigInteger
Return values
BigIntegergetOrder()
Returns the Order
public
getOrder() : BigInteger
Return values
BigIntegermultiplyAddPoints()
Multiply and Add Points
public
multiplyAddPoints(array<string|int, mixed> $points, array<string|int, mixed> $scalars) : array<string|int, int>
Parameters
- $points : array<string|int, mixed>
- $scalars : array<string|int, mixed>
Return values
array<string|int, int>multiplyPoint()
Multiply a point on the curve by a scalar
public
multiplyPoint(array<string|int, mixed> $p, Integer $d) : array<string|int, mixed>
Uses the montgomery ladder technique as described here:
https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Montgomery_ladder https://github.com/phpecc/phpecc/issues/16#issuecomment-59176772
Parameters
- $p : array<string|int, mixed>
- $d : Integer
Return values
array<string|int, mixed>negatePoint()
Negates a point
public
negatePoint(array<string|int, mixed> $p) : array<string|int, object>
Parameters
- $p : array<string|int, mixed>
Return values
array<string|int, object>randomInteger()
Returns a random integer
public
randomInteger() : object
Return values
objectsetBasePoint()
Set x and y coordinates for the base point
public
setBasePoint(string|Integer $x, string|Integer $y) : mixed
Parameters
setCoefficients()
Set coefficients a and b
public
setCoefficients(string $a, string $b) : mixed
Parameters
- $a : string
- $b : string
setModulo()
Sets the modulo
public
setModulo(mixed ...$modulo) : mixed
Parameters
- $modulo : mixed
setOrder()
Sets the Order
public
setOrder(BigInteger $order) : mixed
Parameters
- $order : BigInteger
setReduction()
Use a custom defined modular reduction function
public
setReduction(callable $func) : object
Parameters
- $func : callable
Return values
objectverifyPoint()
Tests whether or not the x / y values satisfy the equation
public
verifyPoint(array<string|int, mixed> $p) : bool
Parameters
- $p : array<string|int, mixed>