Subversion Repositories oidplus

Rev

Rev 846 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /**
  4.  * brainpoolP160t1
  5.  *
  6.  * This curve is a twisted version of brainpoolP160r1 with A = -3. With brainpool,
  7.  * the curves ending in r1 are the "regular" curves and the curves ending in "t1"
  8.  * are the twisted version of the r1 curves. Per https://tools.ietf.org/html/rfc5639#page-7
  9.  * you can convert a point on an r1 curve to a point on a t1 curve thusly:
  10.  *
  11.  *     F(x,y) := (x*Z^2, y*Z^3)
  12.  *
  13.  * The advantage of A = -3 is that some of the point doubling and point addition can be
  14.  * slightly optimized. See http://hyperelliptic.org/EFD/g1p/auto-shortw-projective-3.html
  15.  * vs http://hyperelliptic.org/EFD/g1p/auto-shortw-projective.html for example.
  16.  *
  17.  * phpseclib does not currently take advantage of this optimization opportunity
  18.  *
  19.  * PHP version 5 and 7
  20.  *
  21.  * @category  Crypt
  22.  * @package   EC
  23.  * @author    Jim Wigginton <terrafrost@php.net>
  24.  * @copyright 2017 Jim Wigginton
  25.  * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
  26.  * @link      http://pear.php.net/package/Math_BigInteger
  27.  */
  28.  
  29. namespace phpseclib3\Crypt\EC\Curves;
  30.  
  31. use phpseclib3\Crypt\EC\BaseCurves\Prime;
  32. use phpseclib3\Math\BigInteger;
  33.  
  34. class brainpoolP160t1 extends Prime
  35. {
  36.     public function __construct()
  37.     {
  38.         $this->setModulo(new BigInteger('E95E4A5F737059DC60DFC7AD95B3D8139515620F', 16));
  39.         $this->setCoefficients(
  40.             new BigInteger('E95E4A5F737059DC60DFC7AD95B3D8139515620C', 16), // eg. -3
  41.             new BigInteger('7A556B6DAE535B7B51ED2C4D7DAA7A0B5C55F380', 16)
  42.         );
  43.         $this->setBasePoint(
  44.             new BigInteger('B199B13B9B34EFC1397E64BAEB05ACC265FF2378', 16),
  45.             new BigInteger('ADD6718B7C7C1961F0991B842443772152C9E0AD', 16)
  46.         );
  47.         $this->setOrder(new BigInteger('E95E4A5F737059DC60DF5991D45029409E60FC09', 16));
  48.     }
  49. }
  50.