维吉尼亚密码进行加密明文为helloeverybodygoodafternoon,密钥为how are you ,对应的密文为?
来源:百度知道 编辑:UC知道 时间:2024/07/02 14:50:15
C++编程实现维吉尼亚密码加密解密
编程实现维吉尼亚密码加密解密
要求:用户可以输入密钥
#include
using namespace std;
#define MINCHAR 32
#define CHARSUM 94
char table[CHARSUM][CHARSUM];
bool Init();
bool Encode(char* key, char* source, char* dest);
bool Dncode(char* key, char* source, char* dest);
int main()
{
if(!Init())
{
cout << "初始化错误!" << endl;
return 1;
}
char key[256];
char str1[256];
char str2[256];
int operation;
while(1)
{
do
{
cout << "请选择一个操作:1. 加密; 2. 解密; -1. 退出\n";
cin >> operation;
}while(operation != -1 && operation != 1 && operation != 2);
if(operation == -1)
return 0;
else if(operation == 1)//加密
{
cout << "请输入密钥:";
cin >> key;
cout << "请输入待加密字符串:";
cin >> st