Skip to content

Instantly share code, notes, and snippets.

@Ge0rg3
Created April 10, 2019 22:27
Show Gist options
  • Save Ge0rg3/27dd766a649e4017e96d2b8bc58b8a05 to your computer and use it in GitHub Desktop.
Save Ge0rg3/27dd766a649e4017e96d2b8bc58b8a05 to your computer and use it in GitHub Desktop.
16 bit AES bruteforce challenge for Sunshine CTF '19 https://2019.sunshinectf.org/challenges#16-bit-AES
from Crypto.Cipher import AES
from itertools import product
import binascii
for val in product(range(256), repeat=2):
key = bytes(val)*8
cipher = AES.new(key, AES.MODE_ECB)
msg = cipher.encrypt("hellothisisatest")
z = binascii.hexlify(msg).decode('utf-8')
if z == "d9bf38ed407349d227b859eac20d5394":
print(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment