-
Notifications
You must be signed in to change notification settings - Fork 12
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
base64
to 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
output
is NULL, this function ignoresoutput_size
and returns the necessary size to store the entire decoded data frombase64
. If the data inbase64
is not correctly padded, this will return-1
instead. However, no further checking of the input is done in this mode.If
output
is not NULL, this will convert the base64 data inbase64
and write it tooutput
. Ifoutput_size
is too small for the entire conversion, or if any part of the conversion fails, this will return-1
andoutput
will 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
size
bytes ofdata
to a Base64 string representation. Ifsize
is0
, data may be NULL; otherwise,data
must be non-NULL. - Encode all data stored in
data
to a Base64 string representation.