?? main.cpp
字號:
#include "utility.h"
#include "Decryption.h"
int main()
{
char inputFileName[20],outputFileName[20];
FILE *input,*output;
char ch;
packed_data plaintext,ciphertext,K1,K2;
cout << "————++Simple DES Presentation Program++————" << endl
<< "| <===========Welcome===========> |" << endl
<< "|Author: Dan,Wu Sofeware Engineering 00 No.3 |" << endl
<< "|Run: MicroSoft Visual C++ 6.0 |" << endl
<< "|Data:2003.4.20,Version 1.0 Realeased |" << endl
<< "|_________________________________________________|" << endl;
//******************************產生密碼******************************
GenerateKey(K1,K2);
//******************************解密過程******************************
cout << endl << endl
<< "————++Simple DES Presentation Program++————" << endl
<< "| <===========Welcome===========> |" << endl
<< "|Author: Dan,Wu Sofeware Engineering 00 No.3 |" << endl
<< "|Run: MicroSoft Visual C++ 6.0 |" << endl
<< "|Data:2003.4.20,Version 1.0 Realeased |" << endl
<< "|_________________________________________________|" << endl;
cout << "請輸入欲解密文件名:" << flush;
gets(inputFileName);
cout << "請指定解密后文件名:" << flush;
gets(outputFileName);
if((input = fopen(inputFileName,"r")) == NULL){
cout << "打開文件<" << inputFileName << ">時失敗!" << endl;
cout << "程序異常退出!!!" << endl;
exit(0);
}
if((output = fopen(outputFileName,"w")) == NULL){
cout << "創建文件<" << outputFileName << ">時失敗!" << endl;
cout << "程序異常退出!!!" << endl;
exit(0);
}
while(!feof(input)){
ch = getc(input);
ToBitStream(ch,ciphertext);
Decryption(ciphertext,plaintext,K1,K2);
ToChar(plaintext,ch);
putc(ch,output);
}
cout << endl << endl
<< "————++Simple DES Presentation Program++————" << endl
<< "| <===========Welcome===========> |" << endl
<< "|Author: Dan,Wu Sofeware Engineering 00 No.3 |" << endl
<< "|Run: MicroSoft Visual C++ 6.0 |" << endl
<< "|Data:2003.4.20,Version 1.0 Realeased |" << endl
<< "|_________________________________________________|" << endl;
cout << "指定文件: " << inputFileName << "已被解密為: "
<< outputFileName << endl
<< "程序退出!!!" << endl;
fclose(input);
fclose(output);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -