Output points also for the Ed25519 curve.
authorNiels Möller <nisse@lysator.liu.se>
Sat, 6 Sep 2014 15:20:10 +0000 (17:20 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sat, 6 Sep 2014 15:20:10 +0000 (17:20 +0200)
misc/ecc-ref.gp

index 7ef732593350dc353f6a6779f088f62bdcd535d7..d963e990ee1c58928e619fb2f710b8a7528066fa 100644 (file)
@@ -118,4 +118,14 @@ if (S != ellpow(curve25519, B, a), error("curve25519 dh error"));
 print("curve25519");
 out(a, A, b, B, S);
 
+/* Convert point on curve25519 to a point on the twisted edwards curve */
+beta = -sqrt(Mod(-486664, p25519));
+ed25519(p) = [p[1] * beta / p[2], (p[1] - 1) / (p[1] + 1)];
+
+Ae = ed25519(A);
+Be = ed25519(B);
+Se = ed25519(S);
+print("ed25519");
+out(a, Ae, b, Be, Se);
+
 quit