DWC_Base64Encode

Syntax

#include <dwc.h>

int DWC_Base64Encode(const char *src, const u32 srclen, char *dst, const u32 dstlen);

Description

This function encodes the data designated with src in Base64 and outputs it as a char-type character string.

If NULL is designated in dst, no conversion will occur and the maximum character string length expected after the conversion is returned. The maximum character string length is a value for the worst-case conversion efficiency, so the actual length is often smaller after conversion.

The post-conversion character string does not include a NULL terminator.

This function uses a special type of Base64, where the three commonly used symbols, "+", "/" , and "=", are replaced by "." , "-" and "*".
You must use the DWC_Base64Decode function to decode the data encoded with this function.

Arguments

src Pointer to the data to convert.
srclen Data size of the data to convert.
dst Pointer to the buffer used to store post-conversion data.
dstlen Size (length of the character string) of the buffer used to store the post-conversion data.

Return Values

-1 Conversion failed.
Maximum length of the character string expected after the conversion exceeds the dstlen argument's value.
Other Actual size (character string length) of the post-conversion data.

See Also

DWC_Base64Decode

Revision History

2007/10/05 Added explanation about the special type of Base64.
2006/07/24 Added a note of caution.
2006/02/27 Updated the description to reflect the changes made to function arguments.
2006/01/18 Initial version.


CONFIDENTIAL