mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
clean up loader and make docs default to hmac sha256
This commit is contained in:
parent
00dd509f18
commit
1bb8b710d4
2 changed files with 9 additions and 2 deletions
|
|
@ -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()
|
||||
'...'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue