commit f996109be5ed01851f2717c23aa36162c625c21a parent 658e3481f1cb086cf5732732835eb7bd3a82071a Author: mpizzzle <michael.770211@gmail.com> Date: Sat, 7 Oct 2017 21:28:10 +0100 alternate solution for set 1 challenge 8 added Diffstat:
| M | set1/detect_aes_in_ecb_mode.py | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/set1/detect_aes_in_ecb_mode.py b/set1/detect_aes_in_ecb_mode.py @@ -1,4 +1,5 @@ from Crypto.Cipher import AES +from sets import Set with open('files/8.txt') as f: file = f.read().splitlines() @@ -11,6 +12,10 @@ for ciphertext in file: for char in charlist: if char > 5: - print ciphertext.decode("hex") - print charlist + print ciphertext break + +for ciphertext in file: + split_cipher = [ciphertext[i:i + 32] for i in range(0, len(ciphertext), 32)] + if len(split_cipher) != len(Set(split_cipher)): + print ciphertext