aboutsummaryrefslogtreecommitdiff
path: root/frozen_deps/Cryptodome/Hash/CMAC.py
diff options
context:
space:
mode:
Diffstat (limited to 'frozen_deps/Cryptodome/Hash/CMAC.py')
-rw-r--r--frozen_deps/Cryptodome/Hash/CMAC.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/frozen_deps/Cryptodome/Hash/CMAC.py b/frozen_deps/Cryptodome/Hash/CMAC.py
index df69f00..8feb79f 100644
--- a/frozen_deps/Cryptodome/Hash/CMAC.py
+++ b/frozen_deps/Cryptodome/Hash/CMAC.py
@@ -20,7 +20,6 @@
# SOFTWARE.
# ===================================================================
-import sys
from binascii import unhexlify
from Cryptodome.Hash import BLAKE2s
@@ -29,8 +28,6 @@ from Cryptodome.Util.number import long_to_bytes, bytes_to_long
from Cryptodome.Util.py3compat import bord, tobytes, _copy_bytes
from Cryptodome.Random import get_random_bytes
-if sys.version_info[:2] == (2, 6):
- memoryview = bytes
# The size of the authentication tag produced by the MAC.
digest_size = None
@@ -245,11 +242,15 @@ class CMAC(object):
raise ValueError("MAC check failed")
def hexverify(self, hex_mac_tag):
- """Return the **printable** MAC tag of the message authenticated so far.
+ """Verify that a given **printable** MAC (computed by another party)
+ is valid.
- :return: The MAC tag, computed over the data processed so far.
- Hexadecimal encoded.
- :rtype: string
+ Args:
+ hex_mac_tag (string): the expected MAC of the message, as a hexadecimal string.
+
+ Raises:
+ ValueError: if the MAC does not match. It means that the message
+ has been tampered with or that the MAC key is incorrect.
"""
self.verify(unhexlify(tobytes(hex_mac_tag)))