Convert to binary and convert back to strings

Grant Edwards grante at visi.com
Thu Feb 22 09:58:41 EST 2007


On 2007-02-22, Grant Edwards <grante at visi.com> wrote:
> 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.

I should add that even "strong" encryption will only slow down
a curious user by 10 minutes if the encryption/decryption key
is embedded in the program...

Trying to hide things from users is usually futile unless you
want put a lot of work into it...

-- 
Grant Edwards                   grante             Yow!  Do you have exactly
                                  at               what I want in a plaid
                               visi.com            poindexter bar bat??



More information about the Python-list mailing list