This commit is contained in:
2022-04-21 13:06:03 +08:00
parent be21e720ec
commit 4a5d575687
5 changed files with 283 additions and 1 deletions

40
test/BASE64.h Normal file
View File

@@ -0,0 +1,40 @@
#ifndef __DAKUANG_BASE64_H__
#define __DAKUANG_BASE64_H__
#include <string>
namespace LenheartBase
{
class CBASE64
{
public:
// 执行BASE64编码操作
static std::string encode(const std::string& str);
// 执行BASE64解码操作
static std::string decode(const std::string& str);
// 执行RSA私匙解密操作
static std::string RsaPriDecrypt(const std::string& cipher_text, const std::string& pri_key);
// 执行RSA私匙加密操作
static std::string RsaPriEncrypt(const std::string& clear_text, const std::string& pri_key);
private:
// 分组编码
static int __encode(unsigned char* pDest, const unsigned char* pSrc, size_t nSrcLen);
// 分组解码
static int __decode(unsigned char* pDest, const unsigned char* pSrc, size_t nSrcLen);
private:
// 编解码转换表
static unsigned char s_encTable[];
static unsigned char s_decTable[];
};
}
#endif