Base64基础知识可以参考此文章,非常详细:http://blog.youkuaiyun.com/morewindows/article/details/11871429
转换为Base64,输入数据必须以三个字节为一组,转为为4个字节的可视字符。下面主要是根据下图的映射表就行编程:
以下代码实现了Base64的编码规则
#include <bitset>
#include <iostream>
#include <string>
#include <vector>
#include <list>
using namespace std;
int main( int argc, char ** argv ){
//原始数据
unsigned char data[] ={0xb3, 0x7a, 0x4f, 0x2c, 0xc0, 0x62, 0x4f, 0x16, 0x90 ,0xf6,0x46, 0x06, 0xcf, 0x38, 0x59, 0x45, 0xb2, 0xbe, 0xc4, 0xea};
// 把data数据转换为对应的 bitset
list< bi