Simple way to encode a string according to a password?

Posted by RexE on Stack Overflow See other posts from Stack Overflow or by RexE
Published on 2010-03-22T06:23:04Z Indexed on 2010/03/22 6:31 UTC
Read the original article Hit count: 327

Filed under:
|
|

Does Python have a built-in, simple way of encoding/decoding strings using a password?

Something like this:

>>> encode('John Doe', password = 'mypass')
'sjkl28cn2sx0'
>>> decode('sjkl28cn2sx0', password = 'mypass')
'John Doe'

I would like to use these encrypted strings as URL parameters. My goal is obfuscation, not strong security. I realize I could use a database table to store keys and values, but am trying to be minimalist.

© Stack Overflow or respective owner

Related posts about password

Related posts about encryption