TCPIP_Helper_Base64Encode Function
C
uint16_t TCPIP_Helper_Base64Encode(
const uint8_t* sourceData,
uint16_t sourceLen,
uint8_t* destData,
uint16_t destLen
);
Description
This function encodes a binary array to base-64.
Preconditions
sourceData, destData - valid pointers.
Parameters
Parameters | Description |
---|---|
sourceData | Pointer to a string of binary data. |
sourceLen | Length of the binary source data. |
destData | Pointer to write the base-64 encoded data. |
destLen | Maximum length that can be written to destData. |
Returns
Number of encoded bytes written to destData. This will always be a multiple of 4.
Remarks
Encoding cannot be performed in-place. If sourceData overlaps with destData, the behavior is undefined. The source data is padded with 1 or 2 bytes, if needed, to make the source size a multiple of 3 bytes. Then, for each 3 bytes tuple in the source, 4 output bytes are generated. The output size needed is pad(sourceLen) * 4 / 3 bytes.