diff --git a/ImaginaryCTF/Cbc.py b/ImaginaryCTF/Cbc.py deleted file mode 100644 index 1295630..0000000 --- a/ImaginaryCTF/Cbc.py +++ /dev/null @@ -1,34 +0,0 @@ -from Crypto.Cipher import AES -from Crypto.Util.Padding import pad, unpad -from os import urandom - -def cbc_encrypt(msg: bytes): - msg = pad(msg, 16) - msg = [msg[i:i+16] for i in range(0, len(msg), 16)] - key = urandom(16) - out = [] - for block in msg: - cipher = AES.new(key, AES.MODE_ECB) - next = cipher.encrypt(block) - out.append(next) - key = next - out = b"".join(out) - return key, out - -ct = b"\xa2\xb8 <\xf2\x85\xa3-\xd1\x1aM}\xa9\xfd4\xfag