Apply suggestions from code review
Comments and a minor refactor for consistency.
This commit is contained in:
parent
9cb9e0f9bc
commit
f8008a01fd
|
@ -99,10 +99,7 @@ def map_to_curve_simple_swu(u):
|
|||
e1 = x1 == Fp(0)
|
||||
x1 = x1 + Fp(1)
|
||||
|
||||
if e1:
|
||||
x1 = c2
|
||||
else:
|
||||
x1 = x1
|
||||
x1 = c2 if e1 else x1 # If (tv1 + tv2) == 0, set x1 = -1 / Z
|
||||
|
||||
x1 = x1 * c1 # x1 = (-B / A) * (1 + (1 / (Z^2 * u^4 + Z * u^2)))
|
||||
gx1 = x1.exp(2)
|
||||
|
|
|
@ -97,6 +97,7 @@ class Point(object):
|
|||
elif a.is_identity:
|
||||
return self
|
||||
else:
|
||||
# Hüseyin Hışıl. “Elliptic Curves, Group Law, and Efficient Computation”. PhD thesis.
|
||||
# <https://core.ac.uk/download/pdf/10898289.pdf> section 4.1
|
||||
(x1, y1) = (self.x, self.y)
|
||||
(x2, y2) = (a.x, a.y)
|
||||
|
@ -119,6 +120,7 @@ class Point(object):
|
|||
if self.is_identity:
|
||||
return self
|
||||
|
||||
# Hüseyin Hışıl. “Elliptic Curves, Group Law, and Efficient Computation”. PhD thesis.
|
||||
# <https://core.ac.uk/download/pdf/10898289.pdf> section 4.1
|
||||
λ = (Fp(3) * self.x * self.x + PALLAS_ISO_A) / (self.y + self.y)
|
||||
x3 = λ*λ - self.x - self.x
|
||||
|
|
Loading…
Reference in New Issue