anyone here got a function to find is a string is base64 encoded?

Mark Brownell gizmotron at earthlink.net
Sun Jul 25 10:25:31 EDT 2004


on 7/24/04 8:06 PM, Mark Brownell at gizmotron at earthlink.net wrote:

> on 7/24/04 12:21 PM, Andre Garzia at soapdog at mac.com wrote:
> 
>> Hi Folks,
>> 
>> I am trying to determine if a string is base64 encoded, I don't know in
>> advance if it will be or not, but I need to find out so that I can
>> decode as needed. Any hint?
>> 
>> cheers
>> andre

This is as good as time as any. This topic goes to encryption as well. How
would you know to decrypt as well as base64Decode? I use a trick I picked up
from Richard Gaskin's Fun Pack/UnPack secret decoder ring stack. He was
placing a header in front of the data to be processed. This was a throw away
line if I remember correctly. I was using 16 random characters as a front
pad to my CBC version of Blowfish. This is a good idea if you want to add
extra security to your transferred data. My user app just threw away the
first 16 characters after decoding it.

So what you do is use a throw away first line with instructions in that line
that tell you that it's compressed, base64Encodded, encrypted, and/or has a
throw away pad set. What you do about unknown data is another question. It
is highly unlikely that if you base64decode a string that is not encoded
that you will be able to find any recognizable words. Perhaps a search for
"and, or, the" pr "What, Where, or Why" might answer the query as a proper
test.

Mark



More information about the use-livecode mailing list