Answer the question
In order to leave comments, you need to log in
How to find the parameters (a, h) of an elliptic curve?
I'm using Go, and there, under the elliptic.P256() curve from crypto/elliptic , it means secp256r1 The recommended
parameters for this elliptic curve can be checked by comparing with
https://www.secg.org/sec2-v2.pdf#page=13&zoom=100 ,0,884
But CurveParams does not contain all parameters
type CurveParams struct {
P *big.Int // the order of the underlying field
N *big.Int // the order of the base point
B *big.Int // the constant of the curve equation
Gx, Gy *big.Int // (x,y) of the base point
BitSize int // the size of the underlying field
Name string // the canonical name of the curve
}
B, _ := new(big.Int).SetString("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16)
Gx, _ := new(big.Int).SetString("6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", 16)
Gy, _ := new(big.Int).SetString("4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5", 16)
x3:=new(big.Int).Mul(Gx, Gx)
x3.Mul(x3, Gx)
Gy.Mul(Gy, Gy)
Gy.Sub(Gy, x3)
Gy.Sub(Gy, B)
a := Gy.Div(Gy, Gx)
aR,_ := new(big.Int).SetString("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", 16)
fmt.Print(aR.Cmp(a)==0, aR, a)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question