Encrypting a short string?
erikwickstrom at gmail.com
Mon Feb 11 21:11:56 CET 2008
On Feb 11, 3:07 pm, marek.ro... at wp.pl wrote:
> erikcw napisal(a):
> > Hi,
> > I'm trying to devise a scheme to encrypt/obfuscate a short string that
> > basically contains the user's username and record number from the
> > database. I'm using this encrypted string to identify emails from a
> > user. (the string will be in the subject line of the email).
> > I'm trying to figure out which approach I should use to encrypt the
> > data. The string will be less than 20 characters long, and I'd like
> > the encrypted version to be about the same size.
> > I tried DES in the Crypto module, but the cipher text was to long to
> > be usable in this case.
> > Any suggestions?
> > Thanks!
> How about:
> >>> hashlib.sha256("john.sm... at example.com|2937267834").hexdigest()[:20]
But that can't be reversed, right? I'd like to be able to decrypt the
data instead of having to store the hash in my database...
More information about the Python-list