DWC_Base64Decode

Syntax

#include <dwc.h>
int DWC_Base64Decode(const char *src,
                     const unsigned long srclen,
                     char *dst,
                     const unsigned long dstlen);

Arguments

src Pointer to the Base64 string to convert.
srclen Length of the Base64 string source.
dst Pointer to the buffer that stores the converted data.
dstlen Byte size of the buffer that stores the converted data.

Return Values

-1 Conversion failed.
Either the theoretical value for the post-conversion data size exceeds the value of the dstlen argument, or the srclen argument is not a multiple of four.
Other The byte size of the data after conversion.

Description

Decodes the Base64 string specified by src and outputs the data.

If NULL is specified for dst, the function does not convert the string but calculates and returns the post-conversion data size had the conversion actually taken place, assuming no anomalies in the Base64 string. Because the actual conversion of the source is based on this theoretical value for the data size, the post-conversion data size will not exceed this theoretical value, even if there are anomalies in the Base64 string.

This function uses a special type of Base64, where the three commonly used symbols "+", "/" , and "=" are replaced by "." , "-", and "*".
What this function can decode are the Base64 strings that have been encoded by the DWC_Base64Encode function.

See Also

DWC_Base64Encode

Revision History

For the changelog prior to 5.1 PR2, click here.


CONFIDENTIAL