⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aes_test.cpp

📁 算法从speakfs提取
💻 CPP
字号:

#include <stdio.h>
#include <string.h>

#include "aes.h"


int main(void)
{
    char in[]="I have had my best love before, but I did not treasure her. When I lost her, I fell regretful. It is the most painful matter in this world. If God can give me another chance, I will say 3 words to her --- I love you. If you have to give a time limit to this love, I hope it is 10 thousand years";  
	char out[295];
	unsigned char key[]="1234567890123456";
	int len;
	len=strlen(in);
	aes_ctx ectx;
	aes_enc_key(key, 16, &ectx);
	aes_enc_blk((unsigned char *)in, (unsigned char *)out, &ectx);
	for (int i=0; i<294; i++)
	{
		printf("%c",in[i]);
	}
	printf("\n");
	for (i=0; i<294; i++)
	{
		printf("%c ",out[i]);
	}
	printf("\n\n\n");
	aes_dec_key(key, 16, &ectx);
	aes_dec_blk((unsigned char *)out, (unsigned char *)in, &ectx);
	for (i=0; i<294; i++)
	{
		printf("%2x",out[i]&0xff);
	}
	printf("\n");
	for (i=0; i<294; i++)
	{
		printf("%c",in[i]);
	}
	printf("\n");
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -