mac-docs-updates (#11644)

This commit is contained in:
Gonzalo Atienza 2024-09-22 21:23:47 -04:00 committed by GitHub
parent e3629a27b7
commit 9c11549e2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View file

@ -28,6 +28,7 @@ A subset of CMAC with the AES-128 algorithm is described in :rfc:`4493`.
>>> from cryptography.hazmat.primitives import cmac
>>> from cryptography.hazmat.primitives.ciphers import algorithms
>>> key = b"\x00" * 16 # A real key should come from os.urandom(16)
>>> c = cmac.CMAC(algorithms.AES(key))
>>> c.update(b"message to authenticate")
>>> c.finalize()

View file

@ -31,6 +31,7 @@ messages allows an attacker to forge tags. Poly1305 is described in
.. doctest::
>>> from cryptography.hazmat.primitives import poly1305
>>> key = b"\x01" * 32 # A real key should come from os.urandom(32)
>>> p = poly1305.Poly1305(key)
>>> p.update(b"message to authenticate")
>>> p.finalize()