Determine whether a Jacobian tuple p is on the curve (and not infinity)
(self, p1)
| 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.""" |