Created
December 22, 2014 08:19
-
-
Save AntonKueltz/b03578820c94f40e99ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Cipher import AES | |
def detect_ECB_mode(ctxt): | |
blocks = [] | |
for block in range(len(ctxt) / AES.block_size): | |
start, end = block * AES.block_size, (block+1) * AES.block_size | |
blocks.append(ctxt[start:end]) | |
return len(blocks) != len(set(blocks)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment