aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-10-31 14:06:14 -0700
committerDavid Reid <dreid@dreid.org>2013-10-31 14:06:14 -0700
commitc3d029f2de71f74efe8ab6caf6ea9604a83a0531 (patch)
tree2e48f8b9f1ec7575a29c069747aa69f75293cc5f /tests/hazmat/primitives
parent30b161375b168d7e32c27651f1906232b44909f8 (diff)
downloadcryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.tar.gz
cryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.tar.bz2
cryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.zip
Fix python3 compat for the hash_test.
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index 9ae8d217..f5629561 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -73,7 +73,8 @@ def hash_test(backend, hash_cls, params, only_if, skip_message):
md = params[1]
m = hashes.Hash(hash_cls, backend=backend)
m.update(binascii.unhexlify(msg))
- assert m.finalize() == binascii.unhexlify(md.replace(" ", "").lower())
+ expected_md = md.replace(" ", "").lower().encode("ascii")
+ assert m.finalize() == binascii.unhexlify(expected_md)
def generate_base_hash_test(algorithm, digest_size, block_size,
@@ -125,7 +126,7 @@ def long_string_hash_test(backend, algorithm, md, only_if, skip_message):
pytest.skip(skip_message)
m = hashes.Hash(algorithm, backend=backend)
m.update(b"a" * 1000000)
- assert m.finalize() == binascii.unhexlify(md.lower().encode('ascii'))
+ assert m.finalize() == binascii.unhexlify(md.lower().encode("ascii"))
def generate_hmac_test(param_loader, path, file_names, digestmod,