資源簡介
很珍貴的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_
評論
共有 條評論