diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-09-24 20:12:51 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-09-24 20:12:51 -0500 |
commit | 8208fe6a9b92bc7e7060448d75d1641bda62fc8a (patch) | |
tree | 3c330339bdc0778af37c2c404d701bec0ae240d0 /tests | |
parent | ddc9a581efbc11d9b6ccf74c9bcc11c4318be9ae (diff) | |
parent | ace036dc677ec90174859708dc18312a97893d07 (diff) | |
download | cryptography-8208fe6a9b92bc7e7060448d75d1641bda62fc8a.tar.gz cryptography-8208fe6a9b92bc7e7060448d75d1641bda62fc8a.tar.bz2 cryptography-8208fe6a9b92bc7e7060448d75d1641bda62fc8a.zip |
Merge pull request #2364 from alex/cleanups
Some cleanups
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/primitives/test_X963_vectors.py | 6 | ||||
-rw-r--r-- | tests/test_utils.py | 20 | ||||
-rw-r--r-- | tests/utils.py | 24 |
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/hazmat/primitives/test_X963_vectors.py b/tests/hazmat/primitives/test_X963_vectors.py index 14bcff47..0332e601 100644 --- a/tests/hazmat/primitives/test_X963_vectors.py +++ b/tests/hazmat/primitives/test_X963_vectors.py @@ -57,9 +57,9 @@ class TestX963(object): key = binascii.unhexlify(vector["Z"]) sharedinfo = None - if vector["SharedInfo length"] != 0: - sharedinfo = binascii.unhexlify(vector["SharedInfo"]) - key_data_len = vector["key data length"] // 8 + if vector["sharedinfo_length"] != 0: + sharedinfo = binascii.unhexlify(vector["sharedinfo"]) + key_data_len = vector["key_data_length"] // 8 key_data = binascii.unhexlify(vector["key_data"]) xkdf = X963KDF(algorithm=hashfn(), diff --git a/tests/test_utils.py b/tests/test_utils.py index 023f57cf..04182a06 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -3466,24 +3466,24 @@ a7b17902d34276951ceccab87f9661c3e8816 assert load_x963_vectors(vector_data) == [ {"hash": "SHA-1", "count": 0, - "shared secret length": 192, + "shared_secret_length": 192, "Z": "1c7d7b5f0597b03d06a018466ed1a93e30ed4b04dc64ccdd", - "SharedInfo length": 0, - "key data length": 128, + "sharedinfo_length": 0, + "key_data_length": 128, "key_data": "bf71dffd8f4d99223936beb46fee8ccc"}, {"hash": "SHA-1", "count": 1, - "shared secret length": 192, + "shared_secret_length": 192, "Z": "5ed096510e3fcf782ceea98e9737993e2b21370f6cda2ab1", - "SharedInfo length": 0, - "key data length": 128, + "sharedinfo_length": 0, + "key_data_length": 128, "key_data": "ec3e224446bfd7b3be1df404104af953"}, {"hash": "SHA-512", "count": 0, - "shared secret length": 521, + "shared_secret_length": 521, "Z": "00aa5bb79b33e389fa58ceadc047197f14e73712f452caa9fc4c9adb369348b\ 81507392f1a86ddfdb7c4ff8231c4bd0f44e44a1b55b1404747a9e2e753f55ef05a2d", - "SharedInfo length": 128, - "SharedInfo": "e3b5b4c1b0d5cf1d2b3a2f9937895d31", - "key data length": 1024, + "sharedinfo_length": 128, + "sharedinfo": "e3b5b4c1b0d5cf1d2b3a2f9937895d31", + "key_data_length": 1024, "key_data": "4463f869f3cc18769b52264b0112b5858f7ad32a5a2d96d8cffabf7f\ a733633d6e4dd2a599acceb3ea54a6217ce0b50eef4f6b40a5c30250a5a8eeee208002267089db\ f351f3f5022aa9638bf1ee419dea9c4ff745a25ac27bda33ca08bd56dd1a59b4106cf2dbbc0ab2\ diff --git a/tests/utils.py b/tests/utils.py index c0052c9a..cc3f9fcc 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -671,7 +671,7 @@ def load_kasvs_ecdh_vectors(vector_data): result_rx = re.compile(r"([FP]) \(([0-9]+) -") tags = [] - sets = dict() + sets = {} vectors = [] # find info in header @@ -709,8 +709,8 @@ def load_kasvs_ecdh_vectors(vector_data): # Data data = { - "CAVS": dict(), - "IUT": dict(), + "CAVS": {}, + "IUT": {}, } tag = None for line in vector_data: @@ -756,8 +756,8 @@ def load_kasvs_ecdh_vectors(vector_data): vectors.append(data) data = { - "CAVS": dict(), - "IUT": dict(), + "CAVS": {}, + "IUT": {}, } return vectors @@ -772,7 +772,7 @@ def load_x963_vectors(vector_data): # Sets Metadata hashname = None - vector = dict() + vector = {} for line in vector_data: line = line.strip() @@ -791,21 +791,21 @@ def load_x963_vectors(vector_data): count = int(line.split("=")[1].strip()) vector["hash"] = hashname vector["count"] = count - vector["shared secret length"] = shared_secret_len - vector["SharedInfo length"] = shared_info_len - vector["key data length"] = key_data_len + vector["shared_secret_length"] = shared_secret_len + vector["sharedinfo_length"] = shared_info_len + vector["key_data_length"] = key_data_len elif line.startswith("Z"): vector["Z"] = line.split("=")[1].strip() assert math.ceil(shared_secret_len / 8) * 2 == len(vector["Z"]) elif line.startswith("SharedInfo"): if shared_info_len != 0: - vector["SharedInfo"] = line.split("=")[1].strip() - silen = len(vector["SharedInfo"]) + vector["sharedinfo"] = line.split("=")[1].strip() + silen = len(vector["sharedinfo"]) assert math.ceil(shared_info_len / 8) * 2 == silen elif line.startswith("key_data"): vector["key_data"] = line.split("=")[1].strip() assert math.ceil(key_data_len / 8) * 2 == len(vector["key_data"]) vectors.append(vector) - vector = dict() + vector = {} return vectors |