Convert to binary and convert back to strings
Jussi Salmela
tiedon_jano at hotmail.com
Thu Feb 22 06:55:22 EST 2007
Steven D'Aprano kirjoitti:
> On Wed, 21 Feb 2007 16:46:19 -0800, Harlin Seritt wrote:
>
>>> WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a
>>> nuisance for someone that really wants to decrypt the string. But
>>> it might work for your application.
>>>
>>> -Larry
>> Thanks Larry! I was looking for something more beautiful but what the
>> hey, it works!
>
>
> Is this beautiful enough?
>
>
>>>> s = "Python"
>>>> u = unicode(s, "ascii")
>>>> u
> u'Python'
>>>> u.encode('rot13')
> 'Clguba'
>
>
> For extra security, you can encode the string with rot13 twice.
>
>
>
Like this? ;)
>>> s = "Python" ; u = unicode(s, "ascii") ; u
u'Python'
>>> u.encode('rot13')
'Clguba'
>>> u.encode('rot13').encode('rot13')
'Python'
Cheers,
Jussi
More information about the Python-list
mailing list