From Wikibooks, open books for an open world
< BlitzMax‎ | Modules‎ | BaH
Jump to navigation Jump to search

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

Types[edit | edit source]

TBase64[edit | edit source]

Encode/Decode Base64 data.

To Encode :

Import BaH.Base64

Local someData:String = "Woo! BlitzMax Modules rock!"
Local encoded:String = TBase64.Encode(someData, someData.length)
Print "Encoded : " + encoded

To Decode :

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[edit | edit source]


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.