Convert to binary and convert back to strings

Grant Edwards grante at visi.com
Wed Feb 21 22:52:31 EST 2007


On 2007-02-22, Ganesan Rajagopal <rganesan at myrealbox.com> wrote:

>> I am hoping to have it show up some weird un-readable text.
>> And then of course be able to convert it right back to a
>> string. Is this even possible?
>
> Looks like you just want to obfuscate the string. How about
> this?
>
> import base64
> text = 'supercalifragilisticexpialidocius'
> open('sambleb.conf', 'w').write(base64.encodestring(text))
>
> print base64.decodestring(open('sambleb.conf', 'r').read())

It'll only remain obfuscated for about 30 seconds after even a
mildly curious user looks at the file.

-- 
Grant Edwards                   grante             Yow!  INSIDE, I have the
                                  at               same personality disorder
                               visi.com            as LUCY RICARDO!!



More information about the Python-list mailing list