From 6078e855a5a683968cb8958e66d2ad0d4d63c21c Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 23 Feb 2020 12:12:15 +0100 Subject: [PATCH] Elligator script: take vectors from stdin --- tests/gen/elligator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/gen/elligator.py b/tests/gen/elligator.py index a1f1228..23014aa 100755 --- a/tests/gen/elligator.py +++ b/tests/gen/elligator.py @@ -51,6 +51,8 @@ # with this software. If not, see # +import sys # stdin + class fe: """Prime field over 2^255 - 19""" p = 2**255 - 19 @@ -287,12 +289,11 @@ def read_vector(vector): # vector: little endian hex number def read_test_vectors(): vectors = [] - with open("x25519_pk.all.vec") as f: - lines = [x.strip() for x in f.readlines() if x.strip()] - for i in range(len(lines) // 2): - private = read_vector(lines[i*2 ]) - public = read_vector(lines[i*2 + 1]) - vectors.append((private, fe(public))) + lines = [x.strip() for x in sys.stdin.readlines() if x.strip()] + for i in range(len(lines) // 2): + private = read_vector(lines[i*2 ]) + public = read_vector(lines[i*2 + 1]) + vectors.append((private, fe(public))) return vectors vectors = read_test_vectors() -- 2.47.3