资源简介
很珍贵的C语言实现PGP对文件加密解密,无Bug,保证可以直接编译运行!
代码片段和文件信息
// cryptoDemo.cpp : Defines the entry point for the console application.
// Windows: cl cryptoDemo.cpp
// Linux: gcc -o cryptoDemo cryptoDemo.cpp -lcrypto
#include
#include
#include
#include
#include “aes.h“
#pragma comment(lib“libeay32.lib“)
void testAes(char inString[] int inLen char passwd[] int pwdLen)
{
int ij len nLoop nRes;
char enString[1024];
char deString[1024];
unsigned char buf[16];
unsigned char buf2[16];
unsigned char aes_keybuf[32];
AES_KEY aeskey;
// 准备32字节(256位)的AES密码字节
memset(aes_keybuf0x9032);
if(pwdLen<32){ len=pwdLen; } else { len=32;}
for(i=0;i // 输入字节串分组成16字节的块
nLoop=inLen/16; nRes = inLen%16;
// 加密输入的字节串
AES_set_encrypt_key(aes_
评论
共有 条评论