Convert to binary and convert back to strings

Neil Cerutti horpner at yahoo.com
Thu Feb 22 09:27:28 EST 2007


On 2007-02-22, Jussi Salmela <tiedon_jano at hotmail.com> wrote:
> 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'

Woah! You better quadruple it instead.

How about Double Pig Latin?

No, wait! Use the feared UDPLUD code.

You go Ubbi Dubbi to Pig Latin, and then Ubbi Dubbi again.

Let's see here... Ubububythubububonubpubay

That's what I call ubububeautubububifubububulbubay.

-- 
Neil Cerutti
This is not a book to be put down lightly. It should be thrown with great
force. --Dorothy Parker



More information about the Python-list mailing list