From 274f2b52ca8f5f45de6dffd0df7345fd1f23507d Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Fri, 21 Feb 2020 00:21:21 +0100 Subject: [PATCH] Elligator script: added fast_from_edwards --- tests/gen/elligator.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/gen/elligator.py b/tests/gen/elligator.py index fa59588..df9c394 100755 --- a/tests/gen/elligator.py +++ b/tests/gen/elligator.py @@ -240,6 +240,17 @@ def fast_scalarmult(point, scalar): def fast_scalarbase(scalar): return fast_scalarmult(edwards_base, scalar) +def fast_from_edwards(point): + sqA = sqrt(fe(-486664)) # constant + x = point[0] + y = point[1] + z = point[2] + u = z + y + zu = z - y + v = u * z * sqA + zv = zu * x + return (u*zv, v*zu, zu*zv) + # Explicit formula for hash_to_curve # We don't need the v coordinate for X25519, so it is omited def explicit_hash_to_curve(r): -- 2.47.3