]> git.codecow.com Git - Monocypher.git/commitdiff
Elligator script: readability nitpick
authorLoup Vaillant <loup@loup-vaillant.fr>
Thu, 20 Feb 2020 23:06:40 +0000 (00:06 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Thu, 20 Feb 2020 23:06:40 +0000 (00:06 +0100)
The can_curve_to_hash() test takes a Montgomery point as input, whose
coordinates are generally called (u, v), not (x, y).

tests/gen/elligator.py

index f5ef5164a8bd1e3b732618e95023cc941a56b73c..fa59588566b97750c0ae0d9ebc84a898e66df348 100755 (executable)
@@ -111,8 +111,8 @@ def hash_to_curve(r):
     return (u, v)
 
 def can_curve_to_hash(point):
-    x = point[0]
-    return x != -A and is_square(-fe(2) * x * (x + A))
+    u = point[0]
+    return u != -A and is_square(-fe(2) * u * (u + A))
 
 def curve_to_hash(point):
     if not can_curve_to_hash(point):