我尝试过用python实现一个非常简单的OTP,但是由于一些我不理解的原因,我得到了一个错误,它说:“ValueError:Incorrect AES key length(4 bytes)”。 我也是python和OTP的新手!你知道吗
代码如下:
from Crypto.Cipher import AES
import base64
user_input = input("Write here:")
secret_key = '1234567890'
cipher = AES.new(secret_key, AES.MODE_ECB)
encoded = base64.b64encode(cipher.encrypt(user_input))
decoded = cipher.decrypt(base64.b64decode(encoded))
print(decoded.strip())
目前没有回答
相关问题 更多 >
编程相关推荐