From ee91c677a0862914aa7c0bf5829dc59306a93630 Mon Sep 17 00:00:00 2001 From: 1F616EMO~nya Date: Fri, 27 Oct 2023 18:59:27 +0800 Subject: [PATCH] Update CMAC.py --- lib/Crypto/Hash/CMAC.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Crypto/Hash/CMAC.py b/lib/Crypto/Hash/CMAC.py index 7585617b3..764be8617 100644 --- a/lib/Crypto/Hash/CMAC.py +++ b/lib/Crypto/Hash/CMAC.py @@ -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)))