From d3ce70317016791079212d7256c3b7f195b4a375 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 11 Nov 2013 14:46:20 -0800 Subject: Ignore the sections of the NIST files --- tests/utils.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py index cc56a9ac..0b215543 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -14,7 +14,7 @@ import os.path -def load_nist_vectors(vector_data, op): +def load_nist_vectors(vector_data): section = None count = None data = {} @@ -35,32 +35,29 @@ def load_nist_vectors(vector_data, op): section = line[1:-1] continue - if section != op: - continue - # Build our data using a simple Key = Value format name, value = line.split(" = ") # COUNT is a special token that indicates a new block of data if name.upper() == "COUNT": count = value - data[count] = {} + data[section, count] = {} # For all other tokens we simply want the name, value stored in # the dictionary else: - data[count][name.lower()] = value.encode("ascii") + data[section, count][name.lower()] = value.encode("ascii") # We want to test only for a particular operation, we sort them for the # benefit of the tests of this function. return [v for k, v in sorted(data.items(), key=lambda kv: kv[0])] -def load_nist_vectors_from_file(filename, op): +def load_nist_vectors_from_file(filename): base = os.path.join( os.path.dirname(__file__), "hazmat", "primitives", "vectors", ) with open(os.path.join(base, filename), "r") as vector_file: - return load_nist_vectors(vector_file, op) + return load_nist_vectors(vector_file) def load_cryptrec_vectors_from_file(filename): -- cgit v1.2.3