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

Method lift_x

test/functional/test_framework/key.py:103–110  ·  view source on GitHub ↗

Given an X coordinate on the curve, return a corresponding affine point for which the Y coordinate is even.

(self, x)

Source from the content-addressed store, hash-verified

101 return jacobi_symbol(x_3 + self.a * x + self.b, self.p) != -1
102
103 def lift_x(self, x):
104 """Given an X coordinate on the curve, return a corresponding affine point for which the Y coordinate is even."""
105 x_3 = pow(x, 3, self.p)
106 v = x_3 + self.a * x + self.b
107 y = modsqrt(v, self.p)
108 if y is None:
109 return None
110 return (x, self.p - y if y & 1 else y, 1)
111
112 def double(self, p1):
113 """Double a Jacobian tuple p1

Callers 3

setMethod · 0.80
tweak_add_pubkeyFunction · 0.80
verify_schnorrFunction · 0.80

Calls 1

modsqrtFunction · 0.85

Tested by

no test coverage detected