One-Time Pad user input text using a generated random bit

231 views Asked by At

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())
0

There are 0 answers