From: Loup Vaillant Date: Sun, 23 Feb 2020 11:12:15 +0000 (+0100) Subject: Elligator script: take vectors from stdin X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=6078e855a5a683968cb8958e66d2ad0d4d63c21c;p=Monocypher.git Elligator script: take vectors from stdin --- 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()