Debian Codegraph @

lib/util/base64.h

raw
1 /// @file
2 /// @brief Base64 encoding
3 #pragma once
4
5 #include <stddef.h>
6 #include <util/api.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /// how many bytes does it take to encode a given source data length?
13 ///
14 /// @param source_size The number of bytes in the source to encoding
15 /// @return The number of bytes required in the destination of encoding
16 UTIL_API size_t gv_base64_size(size_t source_size);
17
18 /// Base64 encode some data
19 ///
20 /// This function does not return on failure, like memory allocation. It calls
21 /// `exit`. The caller is expected to `free` the returned pointer.
22 ///
23 /// @param source Pointer to the start of data to encode
24 /// @param size Number of bytes in the source
25 /// @return A buffer of the encoded data
26 UTIL_API char *gv_base64(const unsigned char *source, size_t size);
27
28 #ifdef __cplusplus
29 }
30 #endif