Handy one liners for pycrypto Nov 1st, 2010 1 2 3 4 5 6 7 8 9 10 11 12 import base64 from Crypto.Cipher import Blowfish cipher = lambda: Blowfish.new('abc123') encrypt = lambda c, s: base64.b64encode(c.encrypt(s)) decrypt = lambda c, e: c.decrypt(base64.b64decode(e)) c = cipher() enc = encrypt(c, 'this is a secret') dec = decrypt(c, enc) Source: http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/