diff options
author | David Reid <dreid@dreid.org> | 2013-10-31 14:06:14 -0700 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-10-31 14:06:14 -0700 |
commit | c3d029f2de71f74efe8ab6caf6ea9604a83a0531 (patch) | |
tree | 2e48f8b9f1ec7575a29c069747aa69f75293cc5f | |
parent | 30b161375b168d7e32c27651f1906232b44909f8 (diff) | |
download | cryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.tar.gz cryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.tar.bz2 cryptography-c3d029f2de71f74efe8ab6caf6ea9604a83a0531.zip |
Fix python3 compat for the hash_test.
-rw-r--r-- | tests/hazmat/primitives/utils.py | 5 |
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, |