Subversion Repositories oidplus

Rev

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

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