Base64Encoder()

Syntax

Result = Base64Encoder(*InputBuffer, InputSize, *OutputBuffer, OutputSize)
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 bit, 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 slightly larger buffer, like 35% bigger to avoid overflows. 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, StringByteLength(test), @enc, 1024)
  Debug enc 
    
  Debug Base64Decoder(@enc, StringByteLength(enc), @dec, 1024)
  Debug dec

Supported OS

All

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