0

I have tried implementing a very simple OTP in python but for some reasons that I don't understand I am getting an error which says: "ValueError: Incorrect AES key length (4 bytes)". I am a newbie to python and OTP as well!

Here is the code:

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())
jpp
  • 159,742
  • 34
  • 281
  • 339

0 Answers0