资源描述
编写Vigenere加密解密算法集美大学计算机工程学院实验报告 课程名称:现代密码学 指导教师: 实验项目名称:Vigenere算法 实验项目编号: 一、 实验目的 编写Vigenere加密解密算法,并测试。 班级: 姓名: 学号: 组号: 实验成绩: 上机实践日期: 上机实践时间: 2学时 二、实验内容与设计思想 #includeiostream using namespace std; #define MINCHAR 97 #define CHARSUM 26 char tableCHARSUMCHARSUM; 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 key256; char str1256; char str2256; int operation; while(1) do cout operation; while(operation != -1 & operation != 1 & operation != 2); if(operation = -1) return 0; else if(operation = 1)/加密 cout key; cout str1; Encode(key, str1, str2); cout 加密后的字符串: str2 endl; else if(operation = 2)/解密 cout key; cout str1; Dncode(key, str1, str2); cout 解密后的字符串: str2 endl; cout endl; return 0; / 初始化维吉尼亚方阵 bool Init int i, j; for(i = 0; i CHARSUM; i+) for(j = 0; j = 0 ? offset : offset + CHARSUM; *tempDest = MINCHAR + offset; tempDest+; if(!(*(+tempKey) tempKey = key; while(*+tempSource); deststrlen(source) = 0; return true; 三、实验使用环境 操作系统: Microsoft Windows 7 编程环境:Visual C+ 6.0 四、实验步骤和调试过程 五、实验小结 1.实验过程中发现加密时不能使用大写字母。 六、附录 现代密码学教程
展开阅读全文