Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thanks for your answer. I think that according to the devs on cryptography's github, this code uses AES-256:
- ```python
- import os
- from cryptography.hazmat.primitives.ciphers.aead import AESGCM
- to_encrypt = b'secret message'
- k = AESGCM.generate_key(256)
- iv = os.urandom(32)
- a = AESGCM(k)
- encrypted = iv + a.encrypt(iv, to_encrypt, None)
- print(f'{k = }\n{encrypted = }')
- assert to_encrypt == a.decrypt(encrypted[:32], encrypted[32:], None)```
- Is this code okay?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement