testbase64encode.cpp
来自「UDP对QQ来说太重要了。 UDP和TCP是同一个层上的协议」· C++ 代码 · 共 36 行
CPP
36 行
// testBase64Encode.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../hmaccess/hmaccess.h"
int main(int argc, char* argv[])
{
int n,m;
char src[]="1234567abcdefgABCDF";
char buf[1024];
printf("source %d bytes :%s\n",strlen(src),src);
if (HMABase64Encode((unsigned char *)src,strlen(src),(unsigned char *)buf,&n)==HMASP_OK)
{
printf("Base64Encode:%s\n",buf);
m=n+10;
if (HMABase64Decode((unsigned char *)buf,n,(unsigned char *)(buf+m),&n)==HMASP_OK)
{
printf("Decode output %d bytes :%s\n",n,buf+m);
if (strncmp(src,buf+m,n)==0)
printf("....OK\n");
else
printf("....ERROR\n");
return 0;
}
}
printf("error.\n");
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?