###--------------------------------------------------------------------------
### The Montgomery ladder.
-A0 = (A - 2)/4
-
def x25519(n, x1):
## Let Q = (x_1 : y_1 : 1) be an input point. We calculate
### Edwards curve parameters and conversion.
a = k(-1)
-d = k(-A0/(A0 + 1))
+d = -A0/(A0 + 1)
def mont_to_ed(u, v):
return sqrt(-A - 2)*u/v, (u - 1)/(u + 1)