Base 64 encoder/decoder for Lotus Script
This an implementation of Base64 as described in rfc4648 (The Base16, Base32, and Base64 Data Encodings) for the Lotus Notes environment.
Base64 is an algorithm to encode binary data into a ascii text representation. Common applications are
- Passing credentials to web servers: HTTP Authentication: Basic and Digest Access Authentication.
- Transferring binary data in email:For this purpose, the encoding can be run in MIME-mode to produce line breaks.
- Transferring or storing binary data in other formats, like XML.
This library makes use of NotesStreams and NotesMIMEEntity that came with Notes 6.
Usage
- Save and unzip the code to a text file (libBase64.lss)
- Use Domino Designer to create a new empty Lotus Script library ‘libBase64′
- Import libBase64.lss and save the lib
- Now you can include the library (
Use "libBase64"
) and use it:Dim b64 As New CBase64()
Call b64.encode (..)
Samples
Encode a string to base64
Dim b64 As New CBase64()
Print b64.encodeString ("foobar")
Encode a binary file to a base64 encoded file
Dim b64 As New CBase64()
Call b64.encodeFileToFile (fspecInput, fspecOutput)
The result file will have line breaks at column 76. If this is not desired, than it can be suppressed. This will be a bit slower however:
Dim b64 As New CBase64()
b64.bMimeModeEncoding = False
Call b64.encodeFileToFile (fspecInput, fspecOutput)
Decode a base64 encoded file to a (probably binary) file
Dim b64 As New CBase64()
Call b64.decodeFileToFile (fspecInput, fspecOutput)