Skip to content

Commit 56cb9c6

Browse files
committed
Add EllipticCurve.is_infinity() which returns True when point at infinity
This is required for checks in Elligator Squared mapping functions f and r.
1 parent b38afd8 commit 56cb9c6

File tree

1 file changed

+7
-0
lines changed
  • test/functional/test_framework

1 file changed

+7
-0
lines changed

test/functional/test_framework/key.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ def on_curve(self, p1):
9595
z4 = pow(z2, 2, self.p)
9696
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
9797

98+
def is_infinity(self, p1):
99+
"""Return true if Jacobian tuple p is at infinity"""
100+
_, _, z1 = p1
101+
if z1 == 0:
102+
return True
103+
return False
104+
98105
def is_x_coord(self, x):
99106
"""Test whether x is a valid X coordinate on the curve."""
100107
x_3 = pow(x, 3, self.p)

0 commit comments

Comments
 (0)