Skip to content

CF_BASE64_DECODED_SIZE

Category: base64
GitHub: cute_base64.h


Calculates the size of data after base64 decoding it.

#define CF_BASE64_DECODED_SIZE(size) ((((size) + 3) / 4) * 3)
Parameters Description
size The size of base64 encoded data.

Return Value

Returns the number of bytes the raw dencoded data will take up. This will deflate the size ~33%.

Remarks

Use this for the dst_size in cf_base64_decode. Base64 encoding is useful for storing data as text in a copy-paste-safe manner. For more information about base64 encoding see this link: RFC-4648 or Wikipedia Base64.

CF_BASE64_ENCODED_SIZE
cf_base64_decode
cf_base64_encode