class TwistedEdwards extends Base (View source)

Curves over ax^2 + y^2 = 1 + dx^2*y^2

Properties

protected object[] $doubles Doubles from  Base
protected BigInteger $order The Order from  Base
protected Integer $factory Finite Field Integer factory from  Base
protected BigInteger $modulo The modulo
protected object $a Cofficient for x^2
protected object $d Cofficient for x^2*y^2
protected object[] $p Base Point
protected object $zero The number zero over the specified finite field
protected object $one The number one over the specified finite field
protected object $two The number two over the specified finite field

Methods

object
randomInteger()

Returns a random integer

from  Base
object
convertInteger(BigInteger $x)

Converts a BigInteger to a FiniteField integer

from  Base
int
getLengthInBytes()

Returns the length, in bytes, of the modulo

from  Base
int
getLength()

Returns the length, in bits, of the modulo

from  Base
array
multiplyPoint(array $p, Integer $d)

Multiply a point on the curve by a scalar

from  Base
FiniteField
createRandomMultiplier()

Creates a random scalar multiplier

from  Base
setOrder(BigInteger $order)

Sets the Order

from  Base
getOrder()

Returns the Order

from  Base
object
setReduction(callable $func)

Use a custom defined modular reduction function

from  Base
object[]
convertToAffine(array $p)

Returns the affine point

object[]
convertToInternal(array $p)

Converts an affine point to a jacobian coordinate

from  Base
object[]
negatePoint(array $p)

Negates a point

from  Base
int[]
multiplyAddPoints(array $points, array $scalars)

Multiply and Add Points

from  Base
setModulo(BigInteger $modulo)

Sets the modulo

setCoefficients(BigInteger $a, BigInteger $d)

Set coefficients a and b

setBasePoint($x, $y)

Set x and y coordinates for the base point

getA()

Returns the a coefficient

getD()

Returns the a coefficient

array
getBasePoint()

Retrieve the base point as an array

getModulo()

Returns the modulo

bool
verifyPoint(array $p)

Tests whether or not the x / y values satisfy the equation

Details

object randomInteger()

Returns a random integer

Return Value

object

object convertInteger(BigInteger $x)

Converts a BigInteger to a FiniteField integer

Parameters

BigInteger $x

Return Value

object

int getLengthInBytes()

Returns the length, in bytes, of the modulo

Return Value

int

int getLength()

Returns the length, in bits, of the modulo

Return Value

int

array multiplyPoint(array $p, Integer $d)

Multiply a point on the curve by a scalar

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

array $p
Integer $d

Return Value

array

FiniteField createRandomMultiplier()

Creates a random scalar multiplier

Return Value

FiniteField

setOrder(BigInteger $order)

Sets the Order

Parameters

BigInteger $order

BigInteger getOrder()

Returns the Order

Return Value

BigInteger

object setReduction(callable $func)

Use a custom defined modular reduction function

Parameters

callable $func

Return Value

object

object[] convertToAffine(array $p)

Returns the affine point

Parameters

array $p

Return Value

object[]

object[] convertToInternal(array $p)

Converts an affine point to a jacobian coordinate

Parameters

array $p

Return Value

object[]

object[] negatePoint(array $p)

Negates a point

Parameters

array $p

Return Value

object[]

int[] multiplyAddPoints(array $points, array $scalars)

Multiply and Add Points

Parameters

array $points
array $scalars

Return Value

int[]

setModulo(BigInteger $modulo)

Sets the modulo

Parameters

BigInteger $modulo

setCoefficients(BigInteger $a, BigInteger $d)

Set coefficients a and b

Parameters

BigInteger $a
BigInteger $d

setBasePoint($x, $y)

Set x and y coordinates for the base point

Parameters

$x
$y

Integer getA()

Returns the a coefficient

Return Value

Integer

Integer getD()

Returns the a coefficient

Return Value

Integer

array getBasePoint()

Retrieve the base point as an array

Return Value

array

BigInteger getModulo()

Returns the modulo

Return Value

BigInteger

bool verifyPoint(array $p)

Tests whether or not the x / y values satisfy the equation

Parameters

array $p

Return Value

bool