11.1. base64
— Base64 encoding and decoding.¶
Source code: src/encode/base64.h, src/encode/base64.c
Test code: tst/encode/base64/main.c
Test coverage: src/encode/base64.c
Functions
-
int
base64_encode
(char *dst_p, const void *src_p, size_t size)¶ Encode given buffer. The encoded data will be ~33.3% larger than the source data. Choose the destination buffer size accordingly.
- Return
- zero(0) or negative error code.
- Parameters
dst_p
-Encoded output data.
src_p
-Input data.
size
-Number of bytes in the input data.
-
int
base64_decode
(void *dst_p, const char *src_p, size_t size)¶ Decode given base64 encoded buffer. The decoded data will be ~25% smaller than the destination data. Choose the destination buffer size accordingly.
- Return
- zero(0) or negative error code.
- Parameters
dst_p
-Output data.
src_p
-Encoded input data.
size
-Number of bytes in the encoded input data.