[Cryptanalysis] Initialisation Vector

Plain, Cipher, Key를 다 알려줬기 때문에 처음의 블럭에 대해 $Dec(C) \oplus Plain$을 수행해 $IV$를 복원할 수 있습니다.

from Crypto.Cipher import AES
import base64
Plain = 'Marvin: "I am at a rough estimat'
Cipher = base64.b64decode('cY1Y1VPXbhUqzYLIOVR0RhUXD5l+dmymBfr1vIKlyqD8KqHUUp2I3dhFXgASdGWzRhOdTj8WWFTJPK0k/GDEVUBDCk1MiB8rCmTZluVHImczlOXEwJSUEgwDHA6AbiCwyAU58e9j9QbN+HwEm1TPKHQ6JrIOpdFWoYjS+cUCZfo/85Lqi26Gj7JJxCDF8PrBp/EtHLmmTmaAVWS0ID2cJpdmNDl54N7tg5TFTrdtcIplc1tDvoCLFPEomNa5booC')[:32]
Key = base64.b64decode('AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRqrHB0eHyA=')
aes = AES.new(Key, AES.MODE_ECB)
estimate = aes.decrypt(Cipher)
#print(estimate)
for i in range(32):
  print(chr(estimate[i]^ord(Plain[i])),end='')

  Comments