<s> import base64 <EOL> from hashlib import md5 <EOL> from Crypto . Cipher import AES <EOL> from breezeminder . app import app <EOL> BLOCK_SIZE = <NUM_LIT:32> <EOL> PAD_STRING = '<STR_LIT:>>' <EOL> CIPHER_KEY = md5 ( app . config [ '<STR_LIT>' ] ) . hexdigest ( ) <EOL> AES_CIPHER = AES . new ( CIPHER_KEY , AES . MODE_ECB ) <EOL> def _pad ( string ) : <EOL> pad_string = ( BLOCK_SIZE - len ( string ) % BLOCK_SIZE ) * PAD_STRING <EOL> return '<STR_LIT>' % ( string , pad_string ) <EOL> @ app . cache . memoize ( timeout = <NUM_LIT> ) <EOL> def encrypt ( string ) : <EOL> return base64 . b64encode ( AES_CIPHER . encrypt ( _pad ( string ) ) ) <EOL> @ app . cache . memoize ( timeout = <NUM_LIT> ) <EOL> def decrypt ( string ) : <EOL> return AES_CIPHER . decrypt ( base64 . b64decode ( string ) ) . rstrip ( PAD_STRING ) </s>
