Skip to content

Instantly share code, notes, and snippets.

@rturowicz
Last active December 15, 2015 07:59
Show Gist options
  • Save rturowicz/5227886 to your computer and use it in GitHub Desktop.
Save rturowicz/5227886 to your computer and use it in GitHub Desktop.
data ecryption (des)
from Crypto.Cipher import DES
crypt_key = 'secret'
def crypt(what):
k = DES.new(crypt_key, DES.MODE_ECB)
return k.encrypt(what.zfill(32))
def decrypt(what):
k = DES.new(crypt_key, DES.MODE_ECB)
return k.decrypt(what).lstrip('0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment