We needed a handle-based Base 64 encoder/decoder. Looked around the net, found a bunch of code that couldn't easily be adapted to in-memory stuff. Most of them work with files to conserve memory. This is inelegant in scripting environments such as Frontier.
C source code that makes it easy to encode handles in a MIME-compatible way.
I wrote an encoder/decoder. You can download the C source code at:
I built this project using Symantec C++ 7.0.4 on a Mac 9500. You'll need Frontier SDK to build the project.
If you port this code to another platform please put the result on a website, and send me a pointer. Also send email if you think this isn't a compatible implementation of Base 64 encoding. I want to get it right.
BTW, I made it easy to port -- layering out the handle access routines. Of course there's a small performance penalty for this, and if you don't like it, change it. Thanks!
If you're using Frontier and want the Base 64 functionality, you can download system.extensions.base64:
It installs in your Frontier.root, and adds two new verbs base64.encode and base64.decode. It will be part of the next release of Frontier.
PS: The C source code for Base 64 is also on the website.
PPS: Jon Pugh adapted Base64 for HyperCard.