Base64Decoder()

Syntax

Result = Base64Decoder(Input$, *Output, OutputSize)
Description
Decodes the specified Base64 encoded string.

Parameters

Input$ A string containing the encoded data.
*Output The output buffer where the plain data will be copied.It has to be allocated with AllocateMemory().
OutputOffset The offset (in bytes) in the output buffer.
OutputSize The size of the output buffer.

The output buffer can be up to 33% smaller than the input buffer, with a minimum size of 64 bytes. It's recommended to get a slightly larger buffer, like 30% smaller to avoid overflows.

Return value

Returns the length of the decoded data in bytes.

Example

  Text$ = "This is a test string!"

  *Text = AllocateMemory(100)
  PokeS(*Text, 0, Text$)
      
  Encoded$ = Base64Encoder(*Text, 0, Len(Text$))
  Debug "Encoded: " + Encoded$
    
  *DecodedBuffer = AllocateMemory(1024)
  Base64Decoder(Encoded$, *DecodedBuffer, 0, 1024)
  Debug "Decoded: " + PeekS(*DecodedBuffer, 0, -1, #PB_UTF8)

See Also

Base64Encoder()

Supported OS

All

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