Convert a Jacobian point tuple p1 to affine form, or None if at infinity. An affine point is represented as the Jacobian (x, y, 1)
(self, p1)
| 68 | self.b = b % p |
| 69 | |
| 70 | def affine(self, p1): |
| 71 | """Convert a Jacobian point tuple p1 to affine form, or None if at infinity. |
| 72 | |
| 73 | An affine point is represented as the Jacobian (x, y, 1)""" |
| 74 | x1, y1, z1 = p1 |
| 75 | if z1 == 0: |
| 76 | return None |
| 77 | inv = modinv(z1, self.p) |
| 78 | inv_2 = (inv**2) % self.p |
| 79 | inv_3 = (inv_2 * inv) % self.p |
| 80 | return ((inv_2 * x1) % self.p, (inv_3 * y1) % self.p, 1) |
| 81 | |
| 82 | def has_even_y(self, p1): |
| 83 | """Whether the point p1 has an even Y coordinate when expressed in affine coordinates.""" |
no test coverage detected