Emx::Base64类 参考

Base64编解码

#include "Base64.hpp"

静态 Public 成员函数

static void Encode (const std::string &in, std::string &out)
 base64编码 更多...
 
static char * Encode (const uint8_t *data, int size, char *base64)
 base64编码 更多...
 
static int GetEncodeSize (int size)
 获取base64编码所需空间大小 更多...
 
static void Decode (const std::string &in, std::string &out)
 base64解码 更多...
 
static int Decode (const char *base64, uint8_t *data)
 base64解码 更多...
 
static int GetDecodeSize (const char *base64, int size=-1)
 获取base64解码所需空间大小 更多...
 

成员函数说明

◆ Encode() [1/2]

static void Emx::Base64::Encode ( const std::string &  in,
std::string &  out 
)
static
参数
in[in] 需要编码的原始数据
out[out] 编码后的数据

◆ Encode() [2/2]

static char* Emx::Base64::Encode ( const uint8_t *  data,
int  size,
char *  base64 
)
static
参数
data[in] 需要编码的原始数据
size[in] 需要编码的原始数据长度
base64[out] 承接编码后数据的内存地址,需要调用者保证空间够用 base64加密所需长度计算:输出长度=[输入长度/3]*4 ,[]代表上取整
返回
编码后数据的内存地址

◆ GetEncodeSize()

static int Emx::Base64::GetEncodeSize ( int  size)
inlinestatic
参数
size[in] 待编码数据大小
返回
编码后数据大小

◆ Decode() [1/2]

static void Emx::Base64::Decode ( const std::string &  in,
std::string &  out 
)
static
参数
in[in] 需要解码的数据
out[out] 解码后的数据

◆ Decode() [2/2]

static int Emx::Base64::Decode ( const char *  base64,
uint8_t *  data 
)
static
参数
base64[in] 需要解码的数据
data[in] 承接解码后数据的内存地址,需要调用者保证解密空间够用 base64解密所需长度计算:输出长度=输入长度/4*3 ,[]代表上取整
返回
解码后原始数据的实际长度

◆ GetDecodeSize()

static int Emx::Base64::GetDecodeSize ( const char *  base64,
int  size = -1 
)
static
参数
base64[in] 待解码数据
size[in] 待解码数据大小(选填)
返回
解码后数据大小