Skip to content

Commit

Permalink
Fix examples.rst minor syntax and doc errors
Browse files Browse the repository at this point in the history
example issues fixed. the second 'in one step' should not say hmac_key in comments.
  • Loading branch information
Delta-Sigma authored and Legrandin committed Apr 20, 2024
1 parent 2c40af5 commit 98e7718
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Doc/src/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ a MAC authentication tag (HMAC with SHA256), made with a second key.
hmac = HMAC.new(hmac_key, digestmod=SHA256)
tag = hmac.update(cipher.nonce + ciphertext).digest()
for open("encrypted.bin", "wb") as f:
with open("encrypted.bin", "wb") as f:
f.write(tag)
f.write(nonce)
f.write(cipher.nonce)
f.write(ciphertext)
# Share securely aes_key and hmac_key with the receiver
Expand Down Expand Up @@ -95,7 +95,7 @@ like :ref:`EAX <eax_mode>`, :ref:`GCM <gcm_mode>`, :ref:`CCM <ccm_mode>`, :ref:`
f.write(cipher.nonce)
f.write(ciphertext)
# Share securely aes_key and hmac_key with the receiver
# Share securely aes_key with the receiver
# encrypted.bin can be sent over an unsecure channel
Decryption is also simpler:
Expand Down

0 comments on commit 98e7718

Please sign in to comment.