Core/Data/WebHelpers/base64.h File Reference
#include "WString.h"
Include dependency graph for Core/Data/WebHelpers/base64.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
size_t | base64_min_encode_len (size_t in_len) |
Get minimum output buffer size required to encode message of given length. More... | |
size_t | base64_min_decode_len (size_t in_len) |
Get minimum output buffer size required to decode message of given length. More... | |
int | base64_encode (size_t in_len, const unsigned char *in, size_t out_len, char *out) |
encode binary data into base64 digits with MIME style === pads More... | |
String | base64_encode (const unsigned char *in, size_t in_len) |
encode a block of data into base64, stored in a String More... | |
static String | base64_encode (const String &in) |
encode a block of data into base64, both input and output are String objects More... | |
int | base64_decode (size_t in_len, const char *in, size_t out_len, unsigned char *out) |
decode base64 digits with MIME style === pads into binary data More... | |
String | base64_decode (const char *in, size_t in_len) |
decode base64 text into binary data More... | |
static String | base64_decode (const String &in) |
encode a block of data into base64, both input and output are String objects More... | |
Function Documentation
◆ base64_decode() [1/3]
String base64_decode | ( | const char * | in, |
size_t | in_len | ||
) |
decode base64 text into binary data
- Parameters
-
in source base64-encoded text in_len length of input text in characters
- Return values
-
String the decoded text
◆ base64_decode() [2/3]
◆ base64_decode() [3/3]
int base64_decode | ( | size_t | in_len, |
const char * | in, | ||
size_t | out_len, | ||
unsigned char * | out | ||
) |
decode base64 digits with MIME style === pads into binary data
- Parameters
-
in_len length of source base64 text in characters in base64-encoded text out_len size of output buffer out buffer for decoded output
- Return values
-
int length of decoded output, or -1 if output buffer is too small
◆ base64_encode() [1/3]
◆ base64_encode() [2/3]
◆ base64_encode() [3/3]
int base64_encode | ( | size_t | in_len, |
const unsigned char * | in, | ||
size_t | out_len, | ||
char * | out | ||
) |
encode binary data into base64 digits with MIME style === pads
- Parameters
-
in_len quantity of characters to encode in data to encode out_len size of output buffer out buffer for base64-encoded text
- Return values
-
int length of encoded text, or -1 if output buffer is too small
- Note
- Output is broken by newline every 72 characters. Final terminating newline is not included.
◆ base64_min_decode_len()
size_t base64_min_decode_len | ( | size_t | in_len | ) |
Get minimum output buffer size required to decode message of given length.
- Parameters
-
in_len Length of base64-encoded input message in characters
- Return values
-
size_t Number of characters required in output buffer
For decoding, do not assume that input is padded.
◆ base64_min_encode_len()
size_t base64_min_encode_len | ( | size_t | in_len | ) |
Get minimum output buffer size required to encode message of given length.
- Parameters
-
in_len Length of input message in bytes
- Return values
-
size_t Number of bytes required in output buffer
Base-64 encodes 6 bits into one character (4 output chars for every 3 input bytes). However, it also requires padding such that the output size is a multiple of 4 characters.