aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-27 17:00:14 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-28 17:34:37 -0500
commit1bb8b710d444012b7218a08f098a85c4a31ca1bc (patch)
tree91a5e8c1287b56d43ea3daa4f84af318f42994f8
parent00dd509f180b6229cfd4b913274a94df3bc05a00 (diff)
downloadcryptography-1bb8b710d444012b7218a08f098a85c4a31ca1bc.tar.gz
cryptography-1bb8b710d444012b7218a08f098a85c4a31ca1bc.tar.bz2
cryptography-1bb8b710d444012b7218a08f098a85c4a31ca1bc.zip
clean up loader and make docs default to hmac sha256
-rw-r--r--docs/hazmat/primitives/hmac.rst2
-rw-r--r--tests/utils.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/docs/hazmat/primitives/hmac.rst b/docs/hazmat/primitives/hmac.rst
index 993e3179..47b88030 100644
--- a/docs/hazmat/primitives/hmac.rst
+++ b/docs/hazmat/primitives/hmac.rst
@@ -27,7 +27,7 @@ message.
.. doctest::
>>> from cryptography.primitives import hashes, hmac
- >>> h = hmac.HMAC(key, hashes.SHA1)
+ >>> h = hmac.HMAC(key, hashes.SHA256)
>>> h.update(b"message to hash")
>>> h.hexdigest()
'...'
diff --git a/tests/utils.py b/tests/utils.py
index 25291d55..ad676c04 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -127,7 +127,9 @@ def load_openssl_vectors(vector_data):
def load_hash_vectors(vector_data):
vectors = []
- key, msg, md = None, None, None
+ key = None
+ msg = None
+ md = None
for line in vector_data:
line = line.strip()
@@ -154,8 +156,13 @@ def load_hash_vectors(vector_data):
# after MD is found the Msg+MD (+ potential key) tuple is complete
if key is not None:
vectors.append((msg, md, key))
+ key = None
+ msg = None
+ md = None
else:
vectors.append((msg, md))
+ msg = None
+ md = None
else:
raise ValueError("Unknown line in hash vector")
return vectors