Result$ = Base64Encoder(*InputBuffer, InputSize [, Flags])
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.


*InputBuffer The buffer containing the plain data.
InputSize The size of the input buffer.
Flags (optional) It can be a combination of the following values:
  #PB_Cipher_NoPadding: it will not insert additional '=' at the end of the encoded buffer to pad it to 3 bytes boundary.
  #PB_Cipher_URL      : it will use a slightly different encoding, mainly used in URL. The usual '+' and '/' encoded characters
                        will be respectively encoded to '-' and '_'

Return value

Returns the encoded data as a string.


  *Text = UTF8("This is a test string!")
  Encoded$ = Base64Encoder(*Text, MemorySize(*Text))
  Debug "Encoded: " + Encoded$
  *DecodedBuffer = AllocateMemory(1024)
  Base64Decoder(Encoded$, *DecodedBuffer, 1024)
  Debug "Decoded: " + PeekS(*DecodedBuffer, -1, #PB_UTF8)

See Also

Base64Decoder(), Base64DecoderBuffer(), Base64EncoderBuffer()

Supported OS


<- Base64DecoderBuffer() - Cipher Index - Base64EncoderBuffer() ->