base64/base64.h

34 lines
1.3 KiB
C
Raw Permalink Normal View History

2021-05-15 00:33:11 +00:00
/*
2014-09-22 22:30:28 +00:00
base64.c - by Joe DF (joedf@ahkscript.org)
Released under the MIT License
2015-06-12 05:28:32 +00:00
Revision: 2015-06-12 01:26:51
2014-09-22 22:30:28 +00:00
Thank you for inspiration:
http://www.codeproject.com/Tips/813146/Fast-base-functions-for-encode-decode
*/
//Base64 char table function - used internally for decoding
unsigned int b64_int(unsigned int ch);
// in_size : the number bytes to be encoded.
// Returns the recommended memory size to be allocated for the output buffer excluding the null byte
unsigned int b64e_size(unsigned int in_size);
// in_size : the number bytes to be decoded.
// Returns the recommended memory size to be allocated for the output buffer
unsigned int b64d_size(unsigned int in_size);
// in : buffer of "raw" binary to be encoded.
// in_len : number of bytes to be encoded.
// out : pointer to buffer with enough memory, user is responsible for memory allocation, receives null-terminated string
// returns size of output including null byte
2021-05-15 21:16:20 +00:00
unsigned int b64_encode(char* in, unsigned int in_len, char* out);
2014-09-22 22:30:28 +00:00
// in : buffer of base64 string to be decoded.
// in_len : number of bytes to be decoded.
// out : pointer to buffer with enough memory, user is responsible for memory allocation, receives "raw" binary
// returns size of output excluding null byte
2021-05-16 19:21:23 +00:00
int b64_decode(char* in, unsigned int in_len, char* out);