MCPcopy Create free account
hub / github.com/ElementsProject/elements / on_curve

Method on_curve

test/functional/test_framework/key.py:91–96  ·  view source on GitHub ↗

Determine whether a Jacobian tuple p is on the curve (and not infinity)

(self, p1)

Source from the content-addressed store, hash-verified

89 return (x1, (self.p - y1) % self.p, z1)
90
91 def on_curve(self, p1):
92 """Determine whether a Jacobian tuple p is on the curve (and not infinity)"""
93 x1, y1, z1 = p1
94 z2 = pow(z1, 2, self.p)
95 z4 = pow(z2, 2, self.p)
96 return z1 != 0 and (pow(x1, 3, self.p) + self.a * x1 * z4 + self.b * z2 * z4 - pow(y1, 2, self.p)) % self.p == 0
97
98 def is_x_coord(self, x):
99 """Test whether x is a valid X coordinate on the curve."""

Callers 1

setMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected