資源簡介
網(wǎng)上搜到的代碼修改了下。以前主要用于解密C#中用DES加密的帶IV的CBC加密模式的代碼。類化了,只是類名不正確。

代碼片段和文件信息
//?DesCrytoXP.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“stdio.h“
#include?“XPDecrypto.h“
#include?“string.h“
int?main(int?argc?char*?argv[])
{
printf(“加解密測試程序:3Des,CBC模式PAD_ISO_1主要是借鑒他人程序。自己研究不多。\r\n“);
char*?enword?=?“測試程序,如有問題請call?me: rocross@yeah.net“;//加密字符串
char?key[]?=?{“1aa“};//加密key
char?iv[]={“12345123“};//向量
//XPDecrypto::XPPad(PAD_ISO_1enwordstrlen(enword)enword0x0);
char*?buffer?=?new?char[200];
memset(buffer0x0200);
char*?bufferout?=?new?char[200];
memset(bufferout0x0200);
int?PadMode?=?PAD_ISO_1;
XPDecrypto::XP3Des(ENCRYPTECBenwordstrlen(enword)keystrlen(key)buffer200ivPadMode);
printf(“Encrypto:%s\r\n“buffer);
XPDecrypto::XP3Des(DECRYPTECBbufferstrlen(buffer)keystrlen(key)bufferout200ivPadMode);
printf(“Beforecr:%s|length:%d\r\n“enwordstrlen(enword));
printf(“Decrypto:%s\r\n“bufferout);
return?0;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????184381??2010-06-22?14:34??DesCrytoXP\Debug\DesCrytoXP.exe
?????文件???????1003??2010-06-22?14:34??DesCrytoXP\DesCrytoXP.cpp
?????文件???????4716??2010-06-18?10:20??DesCrytoXP\DesCrytoXP.dsp
?????文件????????543??2010-06-18?10:09??DesCrytoXP\DesCrytoXP.dsw
?????文件??????50176??2010-06-22?14:34??DesCrytoXP\DesCrytoXP.ncb
?????文件??????54784??2010-06-22?14:34??DesCrytoXP\DesCrytoXP.opt
?????文件???????1354??2010-06-22?14:34??DesCrytoXP\DesCrytoXP.plg
?????文件???????1232??2010-06-18?10:09??DesCrytoXP\ReadMe.txt
?????文件????????297??2010-06-18?10:09??DesCrytoXP\StdAfx.cpp
?????文件????????667??2010-06-18?10:09??DesCrytoXP\StdAfx.h
?????文件??????18432??2010-06-22?14:33??DesCrytoXP\XPDecrypto.cpp
?????文件???????2290??2010-06-22?14:13??DesCrytoXP\XPDecrypto.h
?????目錄??????????0??2010-06-22?14:34??DesCrytoXP\Debug
?????目錄??????????0??2010-06-22?14:34??DesCrytoXP
-----------?---------??----------?-----??----
???????????????319875????????????????????14
評論
共有 條評論