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

Method affine

test/functional/test_framework/key.py:70–80  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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."""

Callers 7

has_even_yMethod · 0.95
get_bytesMethod · 0.80
verify_ecdsaMethod · 0.80
sign_ecdsaMethod · 0.80
compute_xonly_pubkeyFunction · 0.80
tweak_add_pubkeyFunction · 0.80
sign_schnorrFunction · 0.80

Calls 1

modinvFunction · 0.85

Tested by

no test coverage detected