class sect409k1 extends Binary (View source)

Properties

protected object[] $doubles Doubles from  Base
protected BigInteger $order The Order from  Binary
protected BinaryField $factory Binary Field Integer factory from  Binary
protected object $a Cofficient for x^1 from  Binary
protected object $b Cofficient for x^0 from  Binary
protected object $p Base Point from  Binary
protected object $one The number one over the specified finite field from  Binary
protected BigInteger $modulo The modulo from  Binary

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

from  Binary
object[]
convertToInternal(array $p)

Converts an affine point to a jacobian coordinate

from  Binary
object[]
negatePoint(array $p)

Negates a point

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

Multiply and Add Points

from  Base
setModulo(...$modulo)

Sets the modulo

from  Binary
setCoefficients(string $a, string $b)

Set coefficients a and b

from  Binary
setBasePoint(string|BinaryInteger $x, string|BinaryInteger $y)

Set x and y coordinates for the base point

from  Binary
array
getBasePoint()

Retrieve the base point as an array

from  Binary
FiniteField[]
addPoint(array $p, array $q)

Adds two points on the curve

from  Binary
FiniteField[]
doublePoint(array $p)

Doubles a point on a curve

from  Binary
array
derivePoint($m)

Returns the X coordinate and the derived Y coordinate

from  Binary
bool
verifyPoint(array $p)

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

from  Binary
getModulo()

Returns the modulo

from  Binary
getA()

Returns the a coefficient

from  Binary
getB()

Returns the a coefficient

from  Binary
__construct()

No description

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

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

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(...$modulo)

Sets the modulo

Parameters

...$modulo

setCoefficients(string $a, string $b)

Set coefficients a and b

Parameters

string $a
string $b

setBasePoint(string|BinaryInteger $x, string|BinaryInteger $y)

Set x and y coordinates for the base point

Parameters

string|BinaryInteger $x
string|BinaryInteger $y

array getBasePoint()

Retrieve the base point as an array

Return Value

array

FiniteField[] addPoint(array $p, array $q)

Adds two points on the curve

Parameters

array $p
array $q

Return Value

FiniteField[]

FiniteField[] doublePoint(array $p)

Doubles a point on a curve

Parameters

array $p

Return Value

FiniteField[]

array derivePoint($m)

Returns the X coordinate and the derived Y coordinate

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

Return Value

array

bool verifyPoint(array $p)

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

Parameters

array $p

Return Value

bool

BigInteger getModulo()

Returns the modulo

Return Value

BigInteger

Integer getA()

Returns the a coefficient

Return Value

Integer

Integer getB()

Returns the a coefficient

Return Value

Integer

__construct()