Created
September 29, 2018 17:45
-
-
Save yarjor/82d98ba5588dd9031f64a5f9a582bc6e to your computer and use it in GitHub Desktop.
[Detect cipher block size] #blockcipher #crypto #oracle #detection
This file contains hidden or 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
def detect_block_size(cipher_box): | |
last_size = len(cipher_box('A')) | |
counter = 0 | |
while True: | |
counter += 1 | |
new_size = len(cipher_box('A' * counter)) | |
if new_size > last_size: | |
return new_size - last_size | |
last_size = new_size | |
# cipher_box is a function that accepts plain-text and returns cipher-text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment