- md5加密和base64编解码的实现分别为两个类,即.h文件和.cpp文件,无需任何外部库,可直接复制调用。
- base64编解码的调用方式如下:
#include "Cbase64.h" #include <iostream> int main() { const std::string s = "需要编码的字符串" ; std::string encoded = base64_encode(reinterpret_cast<const unsigned char*>(s.c_str()), s.length()); std::string decoded = base64_decode(encoded); std::cout << "encoded: " << encoded << std::endl; std::cout << "decoded: " << decoded << std::endl; return 0; }
- md5加密的调用方式如下:
Md5Encode encode_obj; std::string temp = "待加密的字符串"; std::string sum_md5 = encode_obj.Encode(temp);
在VS下用原生C++实现可直接调用的md5加密及base64编解码
猜你喜欢
转载自blog.csdn.net/qq_42308217/article/details/122751598
今日推荐
周排行