MCO_RET mco_lews_base64_encode(
mco_uint1 *in_str,
mco_size_t in_size,
char *out_str,
mco_size_t out_size
);
in_str
in_size
out_str
out_size
This function encodes binary data from
in_strinto a Base64-encoded string and stores the result inout_str.The output is a standard Base64 string (using characters A–Z, a–z, 0–9, '+', '/') without line breaks, and it is null-terminated.
The required size of the output buffer must be at least
4 * ((in_size + 2) / 3) + 1bytes to accommodate the encoded string and the null terminator.#define SHA1_DIGEST_SIZE 20 ... MCO_RET rc; mco_uint1 sha1_buf[SHA1_DIGEST_SIZE]; char base64_buf[29]; // 4 * ((20 + 2) / 3) + 1 = 28 + 1 = 29 ... rc = mco_lews_base64_encode(sha1_buf, SHA1_DIGEST_SIZE, base64_buf, sizeof(base64_buf)); ...
MCO_S_OK
MCO_E_LEWS_NO_ENOUGH_MEMORY