abstract class Base (View source)

Base

Properties

protected object[] $doubles Doubles
protected BigInteger $order The Order
protected Integer $factory Finite Field Integer factory

Methods

object
randomInteger()

Returns a random integer

object
convertInteger(BigInteger $x)

Converts a BigInteger to a FiniteField integer

int
getLengthInBytes()

Returns the length, in bytes, of the modulo

int
getLength()

Returns the length, in bits, of the modulo

array
multiplyPoint(array $p, Integer $d)

Multiply a point on the curve by a scalar

FiniteField
createRandomMultiplier()

Creates a random scalar multiplier

setOrder(BigInteger $order)

Sets the Order

getOrder()

Returns the Order

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 a jacobian coordinate

object[]
negatePoint(array $p)

Negates a point

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

Multiply and Add Points

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[]