Montgomery
        
        extends Base
    
    
            
            in package
            
        
    
    
    
Curves over y^2 = x^3 + a*x + x
Tags
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
- 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
$a
Cofficient for x
    protected
        object
    $a
    
    
    
    
    
$a24
Constant used for point doubling
    protected
        object
    $a24
    
    
    
    
    
$doubles
Doubles
    protected
        array<string|int, object>
    $doubles
    
    
    
    
    
$factory
Prime Field Integer factory
    protected
        PrimeField
    $factory
    
    
    
    
    
$modulo
The modulo
    protected
        BigInteger
    $modulo
    
    
    
    
    
$one
The Number One
    protected
        object
    $one
    
    
    
    
    
$order
The Order
    protected
        BigInteger
    $order
    
    
    
    
    
$p
Base Point
    protected
        object
    $p
    
    
    
    
    
$zero
The Number Zero
    protected
        object
    $zero
    
    
    
    
    
$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
objectconvertToAffine()
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>createRandomMultiplier()
Creates a random scalar multiplier
    public
                    createRandomMultiplier() : FiniteField
    Return values
FiniteFieldgetBasePoint()
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
intgetLengthInBytes()
Returns the length, in bytes, of the modulo
    public
                    getLengthInBytes() : int
    Return values
intgetOrder()
Returns the Order
    public
                    getOrder() : BigInteger
    Return values
BigIntegermultiplyAddPoints()
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>
    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
- $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
objectsetBasePoint()
Set x and y coordinates for the base point
    public
                    setBasePoint(BigInteger|Integer $x, BigInteger|Integer $y) : array<string|int, Integer>
    Parameters
- $x : BigInteger|Integer
- $y : BigInteger|Integer
Return values
array<string|int, Integer>setCoefficients()
Set coefficients a
    public
                    setCoefficients(BigInteger $a) : mixed
    Parameters
- $a : BigInteger
setModulo()
Sets the modulo
    public
                    setModulo(BigInteger $modulo) : mixed
    Parameters
- $modulo : BigInteger
setOrder()
Sets the Order
    public
                    setOrder(BigInteger $order) : mixed
    Parameters
- $order : BigInteger
setReduction()
Use a custom defined modular reduction function
    public
                    setReduction(callable $func) : object
    Parameters
- $func : callable
Return values
objectdoubleAndAddPoint()
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