I'm trying to encrpyt & decrypt a simple text in AES with CBC mode in Python (2.7.14) with Pycryptodome (3.7.0)
Here's my code to attempt encryption:
from Crypto.Cipher import AES
from Crypto.Util import Padding
import base64
encryption_key = "1111111111111111111111111111111111111111111111111111111111111111".decode("hex")
text = "Test text"
text_padded = Padding.pad(text, AES.block_size)
iv = "0000000000000000"
cipher = AES.new(encryption_key, AES.MODE_CBC, iv)
cipher_enc = cipher.encrypt(text_padded)
encrypted = iv + cipher_enc
print encrypted
print base64.b64encode(encrypted)
print encrypted.encode("hex")
print base64.b64encode(encrypted).encode("hex")
And the outputs are
0000000000000000X???]????H?
MDAwMDAwMDAwMDAwMDAwMFje9RzRXc3LHt8GBBLTSPQ=
3030303030303030303030303030303058def51cd15dcdcb1edf060412d348f4
4d4441774d4441774d4441774d4441774d4441774d466a6539527a525863334c4874384742424c545350513d
But when I enter the same key, text and initial vector values to http://aes.online-domain-tools.com/, I got different results.
Output is : 6a56bc5c0b05892ae4e63d0ca6b3169b
Here's the screenshot:
What am I doing wrong? How can I get the output value at the online encryption website by pycrypto?