MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / IsOnCurve

Method IsOnCurve

crypto/secp256k1/curve.go:102–114  ·  view source on GitHub ↗

IsOnCurve returns true if the given (x,y) lies on the BitCurve.

(x, y *big.Int)

Source from the content-addressed store, hash-verified

100
101// IsOnCurve returns true if the given (x,y) lies on the BitCurve.
102func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
103 // y² = x³ + b
104 y2 := new(big.Int).Mul(y, y) //y²
105 y2.Mod(y2, BitCurve.P) //y²%P
106
107 x3 := new(big.Int).Mul(x, x) //x²
108 x3.Mul(x3, x) //x³
109
110 x3.Add(x3, BitCurve.B) //x³+B
111 x3.Mod(x3, BitCurve.P) //(x³+B)%P
112
113 return x3.Cmp(y2) == 0
114}
115
116//TODO: double check if the function is okay
117// affineFromJacobian reverses the Jacobian transform. See the comment at the

Callers

nothing calls this directly

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected