📄 des_call.cpp
字号:
#include <iostream>
//#include "conio.h"
#include <fstream>
#include <windows.h>
using namespace std;
const int Sz=1000;
typedef void(*Des_Fun)(char*,char*,long,const char*,int,bool);
int main(void)
{
HINSTANCE Des_Dll;
Des_Fun Process;
Des_Dll = LoadLibrary("des.dll");
int cho=0;
if(Des_Dll)
{
Process=(Des_Fun)GetProcAddress(Des_Dll, "des");
if(Process)
{
bool chc;
char key[64];
char str[Sz];
char buf[Sz];
ifstream in,in_k("key.ini");
ofstream out;
in_k>>key;
cout<<"请输入操作:\n\t\t1:加密\t2:解密"<<endl;
cin>>chc;
//clrscr();
if(chc==1)
{
cho=1;
in.open("明文.txt",ios::binary);
out.open("密文.txt",ios::binary);}
else
{
cho=0;
in.open("密文.txt",ios::binary);
out.open("明文.txt",ios::binary);}
while(in.getline(str,Sz,'\n'))
{
strcpy(buf, str);
Process(buf, buf, sizeof(str), key, sizeof(key), chc);
out<<buf<<"\n";
*str='\0';
}
in.close();
out.close();
FreeLibrary(Des_Dll);
}
if(cho==1)
cout<<"加密成功!"<<endl;
else
cout<<"解密成功!"<<endl;
}
else cout<<"加载DLL文件失败!"<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -