Documentation

Curve25519 extends Montgomery
in package

Curves over y^2 = x^3 + a*x + x

Table of Contents

Properties

$a  : object
Cofficient for x
$a24  : object
Constant used for point doubling
$doubles  : array<string|int, object>
Doubles
$factory  : PrimeField
Prime Field Integer factory
$modulo  : BigInteger
The modulo
$one  : object
The Number One
$order  : BigInteger
The Order
$p  : object
Base Point
$zero  : object
The Number Zero
$naf  : array<string|int, int>
NAF Points

Methods

__construct()  : mixed
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 XZ coordinate
createRandomMultiplier()  : FiniteField
Creates a random scalar multiplier
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
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()  : array<string|int, Integer>
Set x and y coordinates for the base point
setCoefficients()  : mixed
Set coefficients a
setModulo()  : mixed
Sets the modulo
setOrder()  : mixed
Sets the Order
setReduction()  : object
Use a custom defined modular reduction function
doubleAndAddPoint()  : array<string|int, array<string|int, FiniteField>>
Doubles and adds a point on a curve

Properties

$a24

Constant used for point doubling

protected object $a24

$doubles

Doubles

protected array<string|int, object> $doubles

$naf

NAF Points

private array<string|int, int> $naf

Methods

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 XZ coordinate

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

From https://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html

XZ coordinates represent x y as X Z satsfying the following equations:

x=X/Z

Parameters
$p : array<string|int, mixed>
Return values
array<string|int, 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>

Modifies the scalar as described at https://tools.ietf.org/html/rfc7748#page-8

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

setReduction()

Use a custom defined modular reduction function

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

doubleAndAddPoint()

Doubles and adds a point on a curve

private doubleAndAddPoint(array<string|int, mixed> $p, array<string|int, mixed> $q, Integer $x1) : array<string|int, array<string|int, FiniteField>>

See https://tools.ietf.org/html/draft-ietf-tls-curve25519-01#appendix-A.1.3

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

        
On this page

Search results