Botan

Base64 Encoding and Decoding

License
Botan is released under the Simplified BSD License (see LICENSE.md)

size_t  base64Encode(char* output, const(ubyte)* input, size_t input_length, ref size_t input_consumed, bool final_inputs);

Perform base64 encoding

Parameters
char* output an array of at least input_length*4/3 bytes
const(ubyte)* input is some binary data
size_t input_length length of input in bytes
size_t input_consumed is an output parameter which says how many bytes of input were actually consumed. If less than input_length, then the range input[consumed:length] should be passed in later along with more input.
bool final_inputs true iff this is the last input, in which case padding chars will be applied if needed
Returns
number of bytes written to output

string  base64Encode(const(ubyte)* input, size_t input_length);

Perform base64 encoding

Parameters
const(ubyte)* input some input
size_t input_length length of input in bytes
Returns
base64adecimal representation of input

string  base64Encode(Alloc)(auto ref const Vector!(ubyte, Alloc) input);

Perform base64 encoding

Parameters
Vector!(ubyte, Alloc) input some input
Returns
base64adecimal representation of input

size_t  base64Decode(ubyte* output, const(char)* input, size_t input_length, ref size_t input_consumed, bool final_inputs, bool ignore_ws = true);

Perform base64 decoding

Parameters
ubyte* output an array of at least input_length*3/4 bytes
const(char)* input some base64 input
size_t input_length length of input in bytes
size_t input_consumed is an output parameter which says how many bytes of input were actually consumed. If less than input_length, then the range input[consumed:length] should be passed in later along with more input.
bool final_inputs true iff this is the last input, in which case padding is allowed
bool ignore_ws ignore whitespace on input; if false, throw new an exception if whitespace is encountered
Returns
number of bytes written to output

size_t  base64Decode(ubyte* output, const(char)* input, size_t input_length, bool ignore_ws = true);

Perform base64 decoding

Parameters
ubyte* output an array of at least input_length*3/4 bytes
const(char)* input some base64 input
size_t input_length length of input in bytes
bool ignore_ws ignore whitespace on input; if false, throw new an exception if whitespace is encountered
Returns
number of bytes written to output

size_t  base64Decode(ubyte* output, in string input, bool ignore_ws = true);

Perform base64 decoding

Parameters
ubyte* output an array of at least input_length/3*4 bytes
string input some base64 input
bool ignore_ws ignore whitespace on input; if false, throw new an exception if whitespace is encountered
Returns
number of bytes written to output

SecureVector!ubyte  base64Decode(in string input, bool ignore_ws = true);

Perform base64 decoding

Parameters
string input some base64 input string
bool ignore_ws ignore whitespace on input; if false, throw new an exception if whitespace is encountered
Returns
decoded base64 output

SecureVector!ubyte  base64Decode(ref const Vector!ubyte input, bool ignore_ws = true);

Perform base64 decoding

Parameters
Vector!ubyte input some base64 input
bool ignore_ws ignore whitespace on input; if false, throw new an exception if whitespace is encountered
Returns
decoded base64 output