(求助)用VC++做一个简单的密码翻译器

如题所述

是密文对照还是加密解密?

前者:
原型:
int WINAPI icePub_dictionaryCodeTransfer2(char *strDictionaryFilename,char *strSrc,char *strCode,char *strFenge)
输入:strDictionaryFilename 字典文件名
strSrc 待处理单词
strFenge 字典里单词和code之间的分隔符字符串
输出:strCode strSrc对应信息
返回码:

char strCode[1024];
typedef int (WINAPI ICEPUB_DICTIONARYCODETRANSFER2)(char *strDictionaryFilename,char *strSrc,char *strCode,char *strFenge);
ICEPUB_DICTIONARYCODETRANSFER2 *icePub_dictionaryCodeTransfer2 = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_dictionaryCodeTransfer2 = (ICEPUB_DICTIONARYCODETRANSFER2 *)GetProcAddress(hDLLDrv, "icePub_dictionaryCodeTransfer2");
}

if(icePub_dictionaryCodeTransfer2)
icePub_dictionaryCodeTransfer2("汉英字典.txt","我",strCode, " ");

if(hDLLDrv)
FreeLibrary(hDLLDrv);
AfxMessagBox(strCode);

后者:
原型:
int WINAPI icePub_encryptText2(char *strInput, char *strOutputHexstring, char *strKey)
输入:strInput 待加密文本数据串
strKey 单des密钥,8字节长度
输出:strOutputHexstring 加密后16进制串
返回码:

char buff[1024],buff2[1024],key[1024];
int len=0;

strcpy(buff,"Take apart Letter Long, Listen Hidden Never-ending bitterness, Between Sky And Terra, Beartthrob Popple.");
strcpy(key,"11223344");

typedef int (WINAPI ICEPUB_ENCRYPTTEXT2)(char *strInput, char *strOutputHexstring, char *strKey);
ICEPUB_ENCRYPTTEXT2 *icePub_decryptText2 = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_decryptText2=(ICEPUB_ENCRYPTTEXT2 *)GetProcAddress(hDLLDrv,"icePub_encryptText2");
}
if(icePub_decryptText2)
len=icePub_decryptText2(buff,buff2,key);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
AfxMessageBox(buff2);

原型:
int WINAPI icePub_decryptText2(char *strInputHexstring, char *strOutput, char *strKey)
输入:strInputHexstring 待解密16进制串,数据长度为16的倍数
strKey 单des密钥,8字节长度
输出:strOutput 解密后数据
返回码: 解密后数据最大长度,为8的倍数

char buff[1024],buff2[1024],key[1024];
int len=0;

strcpy(buff,"CCF8732A28BA4B6EC7460F43DD95CAEA4E8D100DD35A7667469015EB5722E0C2452D0E66895ECF294E3EAF39473B386E5999D0633F19296A13A44AF0BFAA38A956FBE465A57BA19C5C5FC86754AD029B39CF587EDD4651E20D06A92B8608F6ECD19841F52462A5A020479871017620FE");
strcpy(key,"11223344");

typedef int (WINAPI ICEPUB_DECRYPTTEXT2)(char *strInputHexstring, char *strOutput, char *strKey);
ICEPUB_DECRYPTTEXT2 *icePub_decryptText2 = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_decryptText2=(ICEPUB_DECRYPTTEXT2 *)GetProcAddress(hDLLDrv,"icePub_decryptText2");
}
if(icePub_decryptText2)
len=icePub_decryptText2(buff,buff2,key);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
AfxMessageBox(buff2);追问

求教 加一个联系方式吧QQ七二三八一九八五六

追答

冒汗,加了

温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-12-07
曾经信息安全程序设计课上机时做个一个凯撒加密,不知……
第2个回答  2011-12-07
用stl的map或者set
自己动手,丰衣足食。
相似回答