I am trying aes 128 encryption in ECB mode with the following code.
from Crypto.Cipher import AES
key = 'abcdefghijklmnop'
cipher = AES.new(key.encode('utf8'), AES.MODE_ECB)
msg = cipher.encrypt(b'hello')
print(msg.hex())
decipher = AES.new(key.encode('utf8'), AES.MODE_ECB)
msg_dec = decipher.decrypt(msg)
print(msg_dec)
but I'm getting "ValueError: Data must be aligned to block boundary in ECB mode". It works fine if string is a multiple of 16. I don't know how to do padding, unpadding. How can we solve this ? Please help