class EE::System::Base64¶
Overview¶
#include <base64.hpp> class Base64 { public: // enums enum DecodeMode; // methods static size_t encode(size_t in_len, const unsigned char* in, size_t out_len, char* out); static size_t decode(size_t in_len, const char* in, size_t out_len, unsigned char* out); static size_t decode(size_t in_len, const char* in, size_t out_len, unsigned char* out, DecodeMode mode); static bool encode(std::string_view in, std::string& out); static size_t decode(std::string_view in, std::string& out); static size_t decode(std::string_view in, std::string& out, DecodeMode mode); static size_t encodeSafeOutLen(size_t in_len); static size_t decodeSafeOutLen(size_t in_len); };
Detailed Documentation¶
Methods¶
static size_t 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
Returns:
The final length of the output
static size_t 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. Preserves the historical behavior of ignoring ASCII whitespace.
Returns:
The final length of the output
static size_t decode(size_t in_len, const char* in, size_t out_len, unsigned char* out, DecodeMode mode)
Decode base64 digits with MIME style === pads into binary data. DecodeMode::NoWhitespace avoids all whitespace handling and enables the fastest path.
Returns:
The final length of the output
static bool encode(std::string_view in, std::string& out)
Encodes a string into a base64 string
Returns:
True if encoding was successful
static size_t decode(std::string_view in, std::string& out)
Decodes a base64 string to a string, ignoring ASCII whitespace.
Returns:
The final length of the output, or size_t(-1) on truncation
static size_t decode(std::string_view in, std::string& out, DecodeMode mode)
Decodes a base64 string to a string.
Returns:
The final length of the output, or size_t(-1) on truncation
static size_t encodeSafeOutLen(size_t in_len)
Returns:
A safe encoding output length for an input of the length indicated
static size_t decodeSafeOutLen(size_t in_len)
Returns:
A safe decoding output length for an input of the length indicated