Base64 encoding/decoding sample code

Big thanks to Nick Stephens for donating this sample code to do the not-so-simple algorithm for base 64 encoding/decoding. The comments in the chart refer to this [URL=“http://en.wikipedia.org/wiki/Base64”]Wikipedia page on Base64.

Even if you’re not familiar with the term, I’m guessing you may have seen some base-64 encoded data at some point, perhaps in an email header, it looks like this:

TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=

Here’s the link to the chart you can import:
http://www.opto22.com/site/downloads/dl_drilldown.aspx?aid=4157

Note: this code is perfect for a subroutine, stay tuned more on converting your code into a subroutine.

-OptoMary

Couldn’t find this as a subroutine anywhere. I had it as a subroutine in 9.5 (not sure if I converted it or someone else), but I needed it in 9.4 for a customer so I converted it (to 9.3 basic - the oldest any of my customers are using) and want to post it here for others and my future self.

Base64EncodeDecode.zip (8.3 KB)

Thanks @nick_stephens for the code.

1 Like