from crypto cipher import aes mykey 'pymailcgi ljust( '-'key must be or bytes def do_encode(pswd)over len(pswd if overpswd +'\ ( -overpadlen must be multiple of aesobj aes new(mykeyaes mode_ecbreturn aesobj encrypt(pswddef do_decode(pswd)aesobj aes new(mykeyaes mode_ecbpswd aesobj decrypt(pswdreturn pswd rstrip('\ 'elif userotor######################################################use the standard lib' rotor module to encode pswd this does better job of encryption than code above unfortunatelyit is no longer available in py ######################################################sys stderr write('using rotor\ 'import rotor mykey 'pymailcgi def do_encode(pswd)robj rotor newrotor(mykeyreturn robj encrypt(pswduse enigma encryption def do_decode(pswd)robj rotor newrotor(mykeyreturn robj decrypt(pswdelse######################################################use our own custom scheme as last resort shuffle characters in some reversible fashion caveatvery simple -replace with one of your own ######################################################sys stderr write('using simple\ 'adder def do_encode(pswd)pswd 'vspswd ' res 'for char in pswdres +chr(ord(charadderreturn str(resdef do_decode(pswd)pswd pswd[ :- res 'for char in pswd the pymailcgi server inc each ascii code