Ed25519
class Ed25519 extends TwistedEdwards (View source)
Constants
HASH |
|
SIZE |
|
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 | from TwistedEdwards |
protected object | $a | Cofficient for x^2 | from TwistedEdwards |
protected object | $d | Cofficient for x^2*y^2 | from TwistedEdwards |
protected object[] | $p | Base Point | from TwistedEdwards |
protected object | $zero | The number zero over the specified finite field | from TwistedEdwards |
protected object | $one | The number one over the specified finite field | from TwistedEdwards |
protected object | $two | The number two over the specified finite field | from TwistedEdwards |
Methods
Creates a random scalar multiplier
Converts an affine point to an extended homogeneous coordinate
Tests whether or not the x / y values satisfy the equation
No description
Extract Secret Scalar
Encode a point as a string
Doubles a point on a curve
Adds two points on the curve
Details
in
Base at line 63
object
randomInteger()
Returns a random integer
in
Base at line 73
object
convertInteger(BigInteger $x)
Converts a BigInteger to a FiniteField integer
in
Base at line 83
int
getLengthInBytes()
Returns the length, in bytes, of the modulo
in
Base at line 93
int
getLength()
Returns the length, in bits, of the modulo
in
Base at line 108
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
FiniteField
createRandomMultiplier()
Creates a random scalar multiplier
in
Base at line 144
setOrder(BigInteger $order)
Sets the Order
in
Base at line 154
BigInteger
getOrder()
Returns the Order
in
Base at line 164
object
setReduction(callable $func)
Use a custom defined modular reduction function
object[]
convertToAffine(array $p)
Returns the affine point
object[]
convertToInternal(array $p)
Converts an affine point to an extended homogeneous coordinate
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.
in
Base at line 194
object[]
negatePoint(array $p)
Negates a point
in
Base at line 211
int[]
multiplyAddPoints(array $points, array $scalars)
Multiply and Add Points
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
Integer
getA()
Returns the a coefficient
Integer
getD()
Returns the a coefficient
array
getBasePoint()
Retrieve the base point as an array
BigInteger
getModulo()
Returns the modulo
bool
verifyPoint(array $p)
Tests whether or not the x / y values satisfy the equation
__construct()
object[]
recoverX(BigInteger $y, bool $sign)
Recover X from Y
Implements steps 2-4 at https://tools.ietf.org/html/rfc8032#section-5.1.3
Used by EC\Keys\Common.php
Integer
extractSecret(string $str)
Extract Secret Scalar
Implements steps 1-3 at https://tools.ietf.org/html/rfc8032#section-5.1.5
Used by the various key handlers
string
encodePoint(array $point)
Encode a point as a string
FiniteField[]
doublePoint(array $p)
Doubles a point on a curve
FiniteField[]
addPoint(array $p, array $q)
Adds two points on the curve