Base64Encoder()

Syntax

Result = Base64Encoder(InputBuffer, InputLength, OutputBuffer, OutputLength)
Description
Encodes the specified buffer using the Base64 algorithm. This is widely used in e-mail programs but can be useful for any other programs which need an ASCII only (7 bits, only from 32 to 127 characters) encoding for raw binary files. Result will contain the length (in bytes) of the encoded string.

The output buffer should be at last 33% bigger than the input buffer, with a minimum size of 64 bytes. It's recommended to get a slighty larger buffer, like 35% to avoid overflow. The data can be decoded later with Base64Decoder().

Example:
  test.s = "This is a test string!"
  dec.s = Space(1024) 
  enc.s = Space(1024) 
  
  Debug Base64Encoder(@test, Len(test), @enc, 1024)
  Debug enc 
  
  Debug Base64Decoder(@enc, Len(enc), @dec, 1024)
  Debug dec

Supported OS

Windows, Linux, MacOS X

<- Base64Decoder() - Cipher Index - CRC32Fingerprint() ->