[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

Curves over y^2 = x^3 + a*x + b These are curves used in SEC 2 over prime fields: http://www.secg.org/SEC2-Ver-1.0.pdf The curve is a weierstrass curve with a[1], a[3] and a[2] set to 0.

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

Defines 1 class

Prime:: (22 methods):
  setModulo()
  setCoefficients()
  setBasePoint()
  getBasePoint()
  jacobianAddPointMixedXY()
  jacobianAddPointMixedX()
  jacobianAddPoint()
  addPoint()
  doublePointHelper()
  jacobianDoublePoint()
  jacobianDoublePointMixed()
  doublePoint()
  derivePoint()
  verifyPoint()
  getModulo()
  getA()
  getB()
  multiplyAddPoints()
  getNAFPoints()
  getJSFPoints()
  convertToAffine()
  convertToInternal()


Class: Prime  - X-Ref

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

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


setCoefficients(BigInteger $a, BigInteger $b)   X-Ref
Set coefficients a and b


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

jacobianAddPointMixedXY(array $p, array $q)   X-Ref
Adds two "fresh" jacobian form on the curve

return: FiniteField[]

jacobianAddPointMixedX(array $p, array $q)   X-Ref
Adds one "fresh" jacobian form on the curve

The second parameter should be the "fresh" one

return: FiniteField[]

jacobianAddPoint(array $p, array $q)   X-Ref
Adds two jacobian coordinates on the curve

return: FiniteField[]

addPoint(array $p, array $q)   X-Ref
Adds two points on the curve

return: FiniteField[]

doublePointHelper(array $p)   X-Ref
Returns the numerator and denominator of the slope

return: FiniteField[]

jacobianDoublePoint(array $p)   X-Ref
Doubles a jacobian coordinate on the curve

return: FiniteField[]

jacobianDoublePointMixed(array $p)   X-Ref
Doubles a "fresh" jacobian coordinate on the curve

return: FiniteField[]

doublePoint(array $p)   X-Ref
Doubles a point on a curve

return: FiniteField[]

derivePoint($m)   X-Ref
Returns the X coordinate and the derived Y coordinate

return: array

verifyPoint(array $p)   X-Ref
Tests whether or not the x / y values satisfy the equation

return: boolean

getModulo()   X-Ref
Returns the modulo

return: \phpseclib3\Math\BigInteger

getA()   X-Ref
Returns the a coefficient

return: \phpseclib3\Math\PrimeField\Integer

getB()   X-Ref
Returns the a coefficient

return: \phpseclib3\Math\PrimeField\Integer

multiplyAddPoints(array $points, array $scalars)   X-Ref
Multiply and Add Points

Adapted from:
https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/curve/base.js#L125

return: int[]

getNAFPoints(array $point, $wnd)   X-Ref
Precomputes NAF points

Adapted from:
https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/curve/base.js#L351

return: int[]

getJSFPoints(Integer $k1, Integer $k2)   X-Ref
Precomputes points in Joint Sparse Form

Adapted from:
https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/utils.js#L96

return: int[]

convertToAffine(array $p)   X-Ref
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)

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

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

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