0

I am trying to decrypt a text using python with pycrypto. But I get: ValueError: IV must be 16 bytes long

However my iv is 32 bytes long and I cant change that. My key is also 32 bytes in size Is there a way to do this with pycrypto? I could find anything in the docs.

import Crypto.Cipher.AES as AES
a=0x0
i='68fe3a4cf921122eda3df6c7d5458497'
print(i)
plain="encrypted text"
print(plain)
length = 16 - (len(plain) % 16)
plain += chr(length)*length
print(plain)
plaintext=""

for a in range(0, 0xffffff):
    s="6af6f9fae1ab621c2aba5f80ea4"+hex(a)[2:].zfill(5)
    print(s)
    cipher = AES.new(key=s, mode=AES.MODE_CBC, IV=i)
    text=cipher.decrypt(plain)
    if isinstance(text, unicode):    plaintext=text

print(plaintext)
Alex K.
  • 171,639
  • 30
  • 264
  • 288
Jacknife
  • 1
  • 3

0 Answers0