github.com/fisco-bcos/crypto@v0.0.0-20200202032121-bd8ab0b5d4f1/elliptic/secp256k1.go (about) 1 package elliptic 2 3 import ( 4 "math/big" 5 ) 6 7 var secp256k1 *CurveParams 8 9 func initSecp256k1() { 10 secp256k1 = &CurveParams{Name: "secp256k1"} 11 secp256k1.P, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", 16) 12 secp256k1.N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16) 13 secp256k1.A = new(big.Int) 14 secp256k1.B = new(big.Int).SetInt64(7) 15 secp256k1.Gx, _ = new(big.Int).SetString("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 16) 16 secp256k1.Gy, _ = new(big.Int).SetString("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", 16) 17 secp256k1.BitSize = 256 18 } 19 20 // Secp256k1 returns a Curve which implements secp256k1 (see SEC 2, section 2.4.1) 21 // 22 // The cryptographic operations do not use constant-time algorithms. 23 func Secp256k1() Curve { 24 initonce.Do(initAll) 25 return secp256k1 26 }