I created a function, that uses Crypto.Cipher
:
import os
from Crypto.Cipher import AES
def encrypt_pass(user_entered_plaintext):
encrypt_setup = AES.new(os.urandom(32), AES.MODE_CBC, os.urandom(16))
plaintext = user_entered_plaintext
ciphertext = encrypt_setup.encrypt(plaintext)
print(ciphertext)
return ciphertext
if I try to run this, like:
encrypt_pass('Test')
Im getting this error:
ValueError: Input strings must be a multiple of 16 in length
if I try changing:
encrypt_setup = AES.new(os.urandom(32), AES.MODE_CBC, os.urandom(16))
to
encrypt_setup = AES.new(os.urandom(32), AES.MODE_CBC, os.urandom(8))
I get:
ValueError: IV must be 16 bytes long
How can I force this input string minimum to 8?