ldas-tools-al
2.5.7
|
Base 64 Conversion. More...
#include <base64.hh>
Static Public Member Functions | |
static size_t | encode (std::string &Destination, const bit_vector &Source) |
Encode bit_vector. More... | |
static size_t | encode (char *destination, const void *source, size_t size) |
Encode generic 8 bit data. More... | |
static size_t | decode (bit_vector &Destination, const std::string &Source) |
Decode bit_vector. More... | |
static size_t | decode (void *destination, const char *source) |
Decode generic 8 bit data. More... | |
static size_t | calculateEncodedSize (size_t bytes) |
Compute number of output bytes given the number of input bytes. More... | |
static size_t | calculateDecodedSize (const char *s) |
Compute number of output bytes given a null terminated string. More... | |
static void | setNumCharactersPerLine (const int num) |
Establish the number of characters per line. More... | |
Base 64 Conversion.
This class is used to convert to and from Base 64. Base 64 is a way to encode binary data using printable ASCII characters. It uses 4 characters for every 3 bytes.
This is a static class.
|
static |
Compute number of output bytes given a null terminated string.
Calculate Decoded Size.
Calculates the number of bytes which the passed Base-64 string will decode into.
s | The string to check. |
|
static |
Compute number of output bytes given the number of input bytes.
Calculate Encoded Size.
Calculates the number of characters required to represent the requested number of bytes in Base-64. This does not include the null-terminator.
size | The number of bytes to encode. |
|
static |
Decode bit_vector.
Decode base64 data back into a bit_vector
Destination | Storage space for decoded data |
Source | Storage space for the encoded data |
|
static |
Decode generic 8 bit data.
This translates a Base-64 encoded string into binary data.
destination | The location to write the decoded data. This must be large enough to store the data. The required size can be calculated via the 'calculateDecodedSize' method. |
source | Base64 data. Decoding will stop when the first non-Base64 character, an '=', or a null terminator occurs. |
|
static |
Encode bit_vector.
[out] | Destination | The buffer to hold the base 64 encoded result. |
[in] | Source | The buffer holding the 8-bit data to encode. |
|
static |
Encode generic 8 bit data.
Encodes Base64.
This method translates a block of binary data into Base-64 encoded data. The encoded data is stored in the memory location provided by the user. This destination buffer must be large enough to store the result. The user may calculate what the size needs to be via the calculateEncodedSize method (be sure to add 1 for the null character). This method appends a null character to the end of the encoded string.
destination | The buffer in which to store the encoded data. |
source | The buffer to encode. |
size | The number of bytes in the buffer. |
|
static |
Establish the number of characters per line.
Set number of characters per line.
Sets number of characters per line for the encoded data.
num | Number of characters. |