Skip to content

CF_BASE64_ENCODED_SIZE

Category: base64
GitHub: cute_base64.h


Calculates the size of data after base64 encoding it.

#define CF_BASE64_ENCODED_SIZE(size) ((((size) + 2) / 3) * 4)
Parameters Description
size The size of un-encoded raw data.

Return Value

Returns the number of bytes the base64 encoded data will take up. This will inflate the size ~33%.

Remarks

Use this for the dst_size in cf_base64_encode. 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_decode
CF_BASE64_DECODED_SIZE
cf_base64_encode