Skip to content

Commit

Permalink
Change tag variable name to improve clarity.
Browse files Browse the repository at this point in the history
In the example code, the MAC instance variable name is "mac" and the authentication tag variable name is "mac", which can make the "mac.verify(mac)" call confusing.
  • Loading branch information
jelaiw authored and Legrandin committed Sep 13, 2023
1 parent 3314660 commit 0061029
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/src/hash/kmac256.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ And this is an example showing how to validate the KMAC256 tag::
>>> from Crypto.Hash import KMAC256
>>>
>>> # We have received a message 'msg' together
>>> # with its MAC 'mac'
>>> # with its MAC 'mac_tag'
>>>
>>> secret = b'Protect this thirty-two byte key'
>>> mac = KMAC256.new(key=secret, mac_len=16)
>>> mac.update(msg)
>>> try:
>>> mac.verify(mac)
>>> mac.verify(mac_tag)
>>> print("The message '%s' is authentic" % msg)
>>> except ValueError:
>>> print("The message or the key is wrong")
Expand Down

0 comments on commit 0061029

Please sign in to comment.