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

Method affineFromJacobian

crypto/secp256k1/curve.go:119–129  ·  view source on GitHub ↗

TODO: double check if the function is okay affineFromJacobian reverses the Jacobian transform. See the comment at the top of the file.

(x, y, z *big.Int)

Source from the content-addressed store, hash-verified

117// affineFromJacobian reverses the Jacobian transform. See the comment at the
118// top of the file.
119func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
120 zinv := new(big.Int).ModInverse(z, BitCurve.P)
121 zinvsq := new(big.Int).Mul(zinv, zinv)
122
123 xOut = new(big.Int).Mul(x, zinvsq)
124 xOut.Mod(xOut, BitCurve.P)
125 zinvsq.Mul(zinvsq, zinv)
126 yOut = new(big.Int).Mul(y, zinvsq)
127 yOut.Mod(yOut, BitCurve.P)
128 return
129}
130
131// Add returns the sum of (x1,y1) and (x2,y2).
132func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {

Callers 2

AddMethod · 0.95
DoubleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected