我对密码学不熟悉,对一些代码有疑问。你知道吗
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
key = get_random_bytes(16)
cipher = AES.new(key, AES.MODE_EAX)
ciphertext, tag = cipher.encrypt_and_digest(data)
file_out = open("encrypted.bin", "wb")
[ file_out.write(x) for x in (cipher.nonce, tag, ciphertext) ]
这个代码直接实现安全吗?此代码取自https://pycryptodome.readthedocs.io/en/latest/src/examples.html#encrypt-data-with-aes
如何使用生成的密钥加密字符串?
目前没有回答
相关问题 更多 >
编程相关推荐