-
Notifications
You must be signed in to change notification settings - Fork 11
ST::base64
Michael Hansen edited this page Jan 6, 2018
·
3 revisions
#include <string_theory/codecs>| Name | Summary |
|---|---|
| ST::base64_encode | Encode a sequence of bytes as Base64 |
| ST::base64_decode | Decode a Base64 string into a sequence of bytes |
| Signature | |
|---|---|
| ST::char_buffer ST::base64_decode(const ST::string &base64) | (1) |
| ST_ssize_t ST::base64_decode(const ST::string &base64, void *output, size_t output_size) noexcept | (2) |
-
Decode the base64 string in
base64to a buffer. If the input string contains invalid base64 data, an ST::codec_error is thrown with a message indicating the type of failure. -
If
outputis NULL, this function ignoresoutput_sizeand returns the necessary size to store the entire decoded data frombase64. If the data inbase64is not correctly padded, this will return-1instead. However, no further checking of the input is done in this mode.If
outputis not NULL, this will convert the base64 data inbase64and write it tooutput. Ifoutput_sizeis too small for the entire conversion, or if any part of the conversion fails, this will return-1andoutputwill be left in an indeterminate state.
| Signature | |
|---|---|
| ST::string ST::base64_encode(const void *data, size_t size) | (1) |
| ST::string ST::base64_encode(const ST::char_buffer &data) | (2) |
- Encode the first
sizebytes ofdatato a Base64 string representation. Ifsizeis0, data may be NULL; otherwise,datamust be non-NULL. - Encode all data stored in
datato a Base64 string representation.