Skip to content

Instantly share code, notes, and snippets.

@AntonKueltz
Created December 22, 2014 07:40
Show Gist options
  • Save AntonKueltz/07a2098aff79880fe3ac to your computer and use it in GitHub Desktop.
Save AntonKueltz/07a2098aff79880fe3ac to your computer and use it in GitHub Desktop.
from Crypto.Cipher import AES
def AES_ECB_decrypt(ctxt, key):
ptxt = ''
cipher = AES.new(key, AES.MODE_ECB)
for block in range(len(ctxt) / AES.block_size):
start, end = block * AES.block_size, (block+1) * AES.block_size
ptxt += cipher.decrypt(ctxt[start:end])
return ptxt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment