This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Cipher import AES | |
from Crypto.Random import get_random_bytes | |
hdr = b'To your eyes only' | |
plaintext = b'Attack at dawn' | |
key = b'Sixteen byte key' | |
nonce = get_random_bytes(11) | |
cipher = AES.new(key, AES.MODE_CCM, nonce) | |
cipher.update(hdr) | |
msg = nonce, hdr, cipher.encrypt(plaintext), cipher.digest() |
OlderNewer