Namespace for base64 encoding and decoding functions.
More...
Namespace for base64 encoding and decoding functions.
The actual algorithms are based on these sources:
◆ decode()
Do a base64 decoding of the given data.
- Parameters
-
data | Pointer to the encoded data (C string). |
data_size | Length of the input string. |
- Returns
- A pair of the decoded data length and a std::unique_ptr to the decoded data.
◆ decode_block()
Internal base64 decoding function.
- Parameters
-
input | Pointer to the encoded data (C string). |
input_length | Length of the input string. |
output | Pointer to a pre-allocated output buffer. |
output_length | Length of the output buffer. |
- Returns
- Size of the decoded data (in bytes).
◆ encode()
Do a base64 encoding of the given data.
- Parameters
-
data | Pointer to the data to be encoded. |
data_size | Length of the input data (in bytes). |
- Returns
- A std::unique_ptr to the encoded data.
◆ write_encoded_block()
template<typename HeaderType = std::uint64_t, typename T >
void TNL::base64::write_encoded_block |
( |
const T * | data, |
|
|
const std::size_t | data_length, |
|
|
std::ostream & | output_stream ) |
Write a base64-encoded block of data into the given stream.
The encoded data is prepended with a short header, which is the base64-encoded byte length of the data. The type of the byte length value is HeaderType
.