diff options
Diffstat (limited to 'Lib/hmac.py')
-rw-r--r-- | Lib/hmac.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/hmac.py b/Lib/hmac.py index 956fc65..4297a71 100644 --- a/Lib/hmac.py +++ b/Lib/hmac.py @@ -4,6 +4,7 @@ Implements the HMAC algorithm as described by RFC 2104. """ import warnings as _warnings +from operator import _compare_digest as compare_digest trans_5C = bytes((x ^ 0x5C) for x in range(256)) trans_36 = bytes((x ^ 0x36) for x in range(256)) @@ -13,6 +14,7 @@ trans_36 = bytes((x ^ 0x36) for x in range(256)) digest_size = None + class HMAC: """RFC 2104 HMAC class. Also complies with RFC 4231. @@ -33,7 +35,7 @@ class HMAC: """ if not isinstance(key, bytes): - raise TypeError("expected bytes, but got %r" % type(key).__name__) + raise TypeError("key: expected bytes, but got %r" % type(key).__name__) if digestmod is None: import hashlib |