[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * secp256k1 5 * 6 * This is the curve used in Bitcoin 7 * 8 * PHP version 5 and 7 9 * 10 * @author Jim Wigginton <terrafrost@php.net> 11 * @copyright 2017 Jim Wigginton 12 * @license http://www.opensource.org/licenses/mit-license.html MIT License 13 * @link http://pear.php.net/package/Math_BigInteger 14 */ 15 16 namespace phpseclib3\Crypt\EC\Curves; 17 18 //use phpseclib3\Crypt\EC\BaseCurves\Prime; 19 use phpseclib3\Crypt\EC\BaseCurves\KoblitzPrime; 20 use phpseclib3\Math\BigInteger; 21 22 //class secp256k1 extends Prime 23 class secp256k1 extends KoblitzPrime 24 { 25 public function __construct() 26 { 27 $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F', 16)); 28 $this->setCoefficients( 29 new BigInteger('0000000000000000000000000000000000000000000000000000000000000000', 16), 30 new BigInteger('0000000000000000000000000000000000000000000000000000000000000007', 16) 31 ); 32 $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16)); 33 $this->setBasePoint( 34 new BigInteger('79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16), 35 new BigInteger('483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8', 16) 36 ); 37 38 $this->basis = []; 39 $this->basis[] = [ 40 'a' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16), 41 'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16) 42 ]; 43 $this->basis[] = [ 44 'a' => new BigInteger('114CA50F7A8E2F3F657C1108D9D44CFD8', -16), 45 'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16) 46 ]; 47 $this->beta = $this->factory->newInteger(new BigInteger('7AE96A2B657C07106E64479EAC3434E99CF0497512F58995C1396C28719501EE', -16)); 48 } 49 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body