Documentation

Ed25519 extends TwistedEdwards
in package

Curves over a*x^2 + y^2 = 1 + d*x^2*y^2

Table of Contents

Constants

HASH  = 'sha512'
SIZE  = 32

Properties

$a  : object
Cofficient for x^2
$d  : object
Cofficient for x^2*y^2
$doubles  : array<string|int, object>
Doubles
$factory  : Integer
Finite Field Integer factory
$modulo  : BigInteger
The modulo
$one  : object
The number one over the specified finite field
$order  : BigInteger
The Order
$p  : array<string|int, object>
Base Point
$two  : object
The number two over the specified finite field
$zero  : object
The number zero over the specified finite field
$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 an extended homogeneous coordinate
createRandomMultiplier()  : Integer
Creates a random scalar multiplier
doublePoint()  : array<string|int, FiniteField>
Doubles a point on a curve
encodePoint()  : string
Encode a point as a string
extractSecret()  : Integer
Extract Secret Scalar
getA()  : Integer
Returns the a coefficient
getBasePoint()  : array<string|int, mixed>
Retrieve the base point as an array
getD()  : Integer
Returns the a coefficient
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
recoverX()  : array<string|int, object>
Recover X from Y
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

Constants

Properties

$doubles

Doubles

protected array<string|int, object> $doubles

$factory

Finite Field Integer factory

protected Integer $factory

$one

The number one over the specified finite field

protected object $one

$two

The number two over the specified finite field

protected object $two

$zero

The number zero over the specified finite field

protected object $zero

$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
object

convertToAffine()

Returns the affine point

public convertToAffine(array<string|int, mixed> $p) : array<string|int, Integer>
Parameters
$p : array<string|int, mixed>
Return values
array<string|int, Integer>

convertToInternal()

Converts an affine point to an extended homogeneous coordinate

public convertToInternal(array<string|int, mixed> $p) : array<string|int, Integer>

From https://tools.ietf.org/html/rfc8032#section-5.1.4 :

A point (x,y) is represented in extended homogeneous coordinates (X, Y, Z, T), with x = X/Z, y = Y/Z, x * y = T/Z.

Parameters
$p : array<string|int, mixed>
Return values
array<string|int, Integer>

createRandomMultiplier()

Creates a random scalar multiplier

public createRandomMultiplier() : Integer
Return values
Integer

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>

encodePoint()

Encode a point as a string

public encodePoint(array<string|int, mixed> $point) : string
Parameters
$point : array<string|int, mixed>
Return values
string

extractSecret()

Extract Secret Scalar

public extractSecret(string $str) : Integer

Implements steps 1-3 at https://tools.ietf.org/html/rfc8032#section-5.1.5

Used by the various key handlers

Parameters
$str : string
Return values
Integer

getBasePoint()

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
int

getLengthInBytes()

Returns the length, in bytes, of the modulo

public getLengthInBytes() : int
Return values
int

multiplyAddPoints()

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
object

recoverX()

Recover X from Y

public recoverX(BigInteger $y, bool $sign) : array<string|int, object>

Implements steps 2-4 at https://tools.ietf.org/html/rfc8032#section-5.1.3

Used by EC\Keys\Common.php

Parameters
$y : BigInteger
$sign : bool
Return values
array<string|int, object>

setBasePoint()

Set x and y coordinates for the base point

public setBasePoint(mixed $x, mixed $y) : mixed
Parameters
$x : mixed
$y : mixed

setReduction()

Use a custom defined modular reduction function

public setReduction(callable $func) : object
Parameters
$func : callable
Return values
object

verifyPoint()

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>
Return values
bool

        
On this page

Search results