Skip to content

Commit

Permalink
Update CMAC.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Emojigit authored and Legrandin committed Dec 12, 2023
1 parent 43a466d commit ee91c67
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/Crypto/Hash/CMAC.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,15 @@ def verify(self, mac_tag):
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)))
Expand Down

0 comments on commit ee91c67

Please sign in to comment.