From a276f348ca76b7da405d100d266eeb6359fe7230 Mon Sep 17 00:00:00 2001 From: Kaustubh BM Date: Wed, 5 Oct 2022 13:38:20 +0530 Subject: [PATCH] Delete Cbc.py --- ImaginaryCTF/Cbc.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 ImaginaryCTF/Cbc.py 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