mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-05-29 21:38:03 -04:00
Convenience function for base64_encode() + base64_encode_final(). Internally, we also add base64_encode_to_buffer() This is an internal function that encodes a multiple-of-three long input into a user allocated buffer. base64_encode() and base64_encode_oneshot() uses the new function to do the bulk of the encoding. This allows base64_encode_oneshot() to do a single allocation. This patch also adds unit tests for both base64_encode() and base64_encode_oneshot() (but _not_ for base64_encode_final()). Finally, the type of the 'data' parameter is changed to 'void*'.
9 lines
293 B
C
9 lines
293 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
char *base64_decode(const char *s, size_t *out_len);
|
|
char *base64_encode(const void *data, size_t size);
|
|
void base64_encode_final(const void *data, size_t size, char result[4]);
|
|
char *base64_encode_oneshot(const void *data, size_t size);
|