MLIB
Loading...
Searching...
No Matches
base64.h File Reference

Definition of Base64 encoding/decoding functions. More...

#include <string>

Go to the source code of this file.

Functions

size_t mlib::base64dec (const char *in, void *out)
 Decode a Base64 string.
 
size_t mlib::base64enc (const void *in, char *out, size_t ilen)
 Encode input bytes to Base64 producing a null-terminated string.
 
std::string mlib::base64enc (const std::string &in)
 String-aware overload.
 
std::string mlib::base64dec (const std::string &in)
 String-aware overload.
 

Detailed Description

Definition of Base64 encoding/decoding functions.

(c) Mircea Neacsu 2017

Function Documentation

◆ base64dec() [1/2]

size_t mlib::base64dec ( const char *  in,
void *  out 
)

Decode a Base64 string.

Parameters
ininput string
outoutput decoded bytes
Returns
size of decoded memory area

If output pointer is NULL the function only returns the required size of output block.

◆ base64dec() [2/2]

std::string mlib::base64dec ( const std::string &  in)

String-aware overload.

Parameters
ininput string
Returns
decoded string

◆ base64enc() [1/2]

std::string mlib::base64enc ( const std::string &  in)

String-aware overload.

Parameters
ininput string
Returns
decoded string

◆ base64enc() [2/2]

size_t mlib::base64enc ( const void *  in,
char *  out,
size_t  ilen 
)

Encode input bytes to Base64 producing a null-terminated string.

Parameters
ininput bytes
outoutput encoded string
ilennumber of bytes to encode
Returns
length of encoded string including terminating null character

If output pointer is NULL the function only returns the length of resulting string.