des.c
来自「des在windows平台下得实现」· C语言 代码 · 共 56 行
C
56 行
#include "des.h"
#include "iostream.h"
#include <stdio.h>
#include <string.h>
void main()
{
char iPath[100], oPath[100];
int i,f=0;
char keyString[8];
int key[64];
while(1)
{
cout<<"Please Choose Operation:\n1: Input Key\n2: Encrypt\n3: Decrypt\n4: Eixt\n"<<endl<<"Choice>";
cin>>i;
if(i!=4 && i!=1)
{
cout<<"File Path>";
cin>>iPath;
cout<<"Save Path>";
cin>>oPath;
}
switch(i)
{
case 1:
cout<<"Input Key>";
cin>>keyString;
toBinary(keyString, key);
setKey(key);
f=1;
break;
case 2:
if(!f)
{
cout<<f<<"ERROR: No Key Input!"<<endl;
break;
}
encypher(iPath, oPath);
break;
case 3:
if(!f)
{
cout<<"ERROR: No Key Input!"<<endl;
break;
}
decypher(iPath, oPath);
break;
case 4:
default:
return;
}
cout<<endl;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?