Line data Source code
1 : #pragma once 2 : 3 : #include <stdbool.h> 4 : #include <stddef.h> 5 : 6 : unsigned char *base64_encode(const unsigned char *src, size_t len, 7 : size_t *out_len); 8 : unsigned char *base64_decode(const unsigned char *src, size_t len, 9 : size_t *out_len); 10 : 11 : bool base64_validate(const unsigned char *src, size_t len); 12 : 13 0 : static inline size_t base64_encoded_len(size_t decoded_len) 14 : { 15 : /* This counts the padding bytes (by rounding to the next multiple of 4). */ 16 0 : return ((4u * decoded_len / 3u) + 3u) & ~3u; 17 : }