grimmwerks wrote:
> can I do base64 encoding?
You can encode & decode binary data using Lingo. Base64 encoding uses an
algorithm sort of similar to uuEncode or xxEncode, but with a different
output character set. In a nutshell, the idea is to read in whatever
data you need to encode as binary (BinaryIO Xtra can help you here),
then convert it to a range of ASCII values that falls into the printable
character range.
The conversion algorithm involves the following steps:
1) convert each byte of data to 8-bit binary values
2) arrange the 8-bit values into groups of three 24-bit chunks
3) chop the 24 bits into four 6-bit bytes
4) index those four bytes' values into a printable char set's range
5) repeat steps 1-4 for the next three bytes, until the last
6) convert any remaining empty bytes to "="
Here's the usage of a Base64 encoder/decoder I wrote last year as part
of an encryption suite (ince this is email, I'm encoding text instead of
binary data):
-- Welcome to Director
encodedStr = Encode64("Hey look, I'm using Base64 in Lingo")
put encodedStr
-- "SGV5IGxvb2ssIEknbSB1c2luZyBCYXNlNjQgaW4gTGluZ28="
put Decode64( encodedStr )
-- "Hey look, I'm using Base64 in Lingo"
I think there's more detail on the uuEncode algorithm on DOUG too, if
you're interested. Is this what you're looking for?
Rob
/*********************************
* Rob Wingate, Software Human *
* http://www.vingage.com *
* mailto:[EMAIL PROTECTED] *
*********************************/
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]