Utility class providing Base64 encoding and decoding functionality.
This class implements the Base64 encoding scheme as defined in RFC 4648. All methods are static and the class is not meant to be instantiated. Padding is handled via the '=' character.
- Note
- The standard Base64 alphabet is used ('A-Z', 'a-z', '0-9', '+', '/').
- Example - Encoding binary data:
std::vector<std::uint8_t> data = { 0x48, 0x65, 0x6C, 0x6C, 0x6F };
- Example - Encoding a string:
- Example - Decoding:
if (result)
std::cout << *result;
Definition at line 52 of file base64.h.
|
|
| static std::string | encode (std::span< const std::uint8_t > data) |
| | Encodes binary data into a Base64 string.
|
| |
| static std::string | encode (std::string_view text) |
| | Encodes a text string into a Base64 string.
|
| |
|
| static std::optional< std::vector< std::uint8_t > > | decode (std::string_view input) |
| | Decodes a Base64 string into raw binary data.
|
| |
| static std::optional< std::string > | decode_to_string (std::string_view input) |
| | Decodes a Base64 string into a text string.
|
| |