]> git.codecow.com Git - Monocypher.git/commitdiff
Elligator script: removed erroneous .abs()
authorLoup Vaillant <loup@loup-vaillant.fr>
Thu, 20 Feb 2020 23:00:44 +0000 (00:00 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Thu, 20 Feb 2020 23:00:44 +0000 (00:00 +0100)
Changing the sign of the v coordinate had an effect on the final value
of the final hash, but wasn't detected because my initial tests only
compare to the u coordinate, which appears to be correct.

This doesn't affect the success or failure of the Elligator mapping,
which only look at the u coordinate.  Yet another example of incorrect
crypto that looks like it works...

tests/gen/elligator.py

index dc3073a02f16d4566355a2c1749de70650a81461..f5ef5164a8bd1e3b732618e95023cc941a56b73c 100755 (executable)
@@ -175,7 +175,7 @@ def from_edwards(point):
     x = point[0]
     y = point[1]
     u = (fe(1) + y) / (fe(1) - y)
-    v = (sqrt(fe(-486664)) * u / x).abs()
+    v = (sqrt(fe(-486664)) * u / x)
     return (u, v)
 
 # entire key generation chain