[ Index ]

PHP Cross Reference of DokuWiki




/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/ -> Montgomery.php (summary)

Curves over y^2 = x^3 + a*x + x Technically, a Montgomery curve has a coefficient for y^2 but for Curve25519 and Curve448 that coefficient is 1.

Author: Jim Wigginton
Copyright: 2019 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
Link: http://pear.php.net/package/Math_BigInteger
File Size: 279 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Montgomery:: (8 methods):

Class: Montgomery  - X-Ref

Curves over y^2 = x^3 + a*x + x

setModulo(BigInteger $modulo)   X-Ref
Sets the modulo

setCoefficients(BigInteger $a)   X-Ref
Set coefficients a

setBasePoint($x, $y)   X-Ref
Set x and y coordinates for the base point

return: PrimeInteger[]
param: BigInteger|PrimeInteger $x
param: BigInteger|PrimeInteger $y

getBasePoint()   X-Ref
Retrieve the base point as an array

return: array

doubleAndAddPoint(array $p, array $q, PrimeInteger $x1)   X-Ref
Doubles and adds a point on a curve

See https://tools.ietf.org/html/draft-ietf-tls-curve25519-01#appendix-A.1.3

return: FiniteField[][]

multiplyPoint(array $p, BigInteger $d)   X-Ref
Multiply a point on the curve by a scalar

Uses the montgomery ladder technique as described here:


return: array

convertToInternal(array $p)   X-Ref
Converts an affine point to an XZ coordinate

From https://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html

XZ coordinates represent x y as X Z satsfying the following equations:


return: \phpseclib3\Math\PrimeField\Integer[]

convertToAffine(array $p)   X-Ref
Returns the affine point

return: \phpseclib3\Math\PrimeField\Integer[]