BlitzMax/Modules/BaH/Base64

Base64 is a Public Domain Base64 Encoder/Decoder by Robert Harder. See Base64 for Java source.

=Types=

TBase64
Encode/Decode Base64 data.

To Encode : SuperStrict Import BaH.Base64

Local someData:String = "Woo! BlitzMax Modules rock!" Local encoded:String = TBase64.Encode(someData, someData.length) Print "Encoded : " + encoded To Decode : SuperStrict Import BaH.Base64

Local encodedData:String = "V29vISBCbGl0ek1heCBNb2R1bGVzIHJvY2sh" Local data:Byte[] = TBase64.Decode(encodedData) Local decoded:String = String.FromBytes(data, data.length) Print "Decoded : " + decoded


 * Encode
 * Decode

TBase64: Functions
Function Encode:String( source:Byte Ptr, length:Int, offset:Int = 0, options:Int = 0)

Description: Encode byte data to a Base64 encoded String, starting at offset of length bytes.

Function Decode:Byte[]( source:String, offset:Int = 0, options:Int = 0 )

Description: Decode Base64 encoded String to an array of Bytes, starting at offset.