您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 《网络信息安全技术》-实验报告-破译vigenère-密码加密的密文
1实验报告1课程名称网络信息安全技术任课教师姓名朱云初学号院系软件学院专业软件工程一、实验名称:实验一、破译vigenère密码加密的密文二、实验目的:熟悉vigenère密码加密及解密方法三、实验内容及要求密钥长度3~16;明文为普通英文文章(仅含小写字母);实现vigenère加密、解密;破译密文提交的报告:选择的密钥、明文、加密后的密文;破译密文的过程;分析使用、破译vigenère密码时应当考虑的所有因素。四、实验材料、工具、或软件普通计算机一台,并安装JavaApplet、IE、DreamweaverMX2004等软件五、实验步骤(或记录)1、选择的密钥、明文、加密后的密文密钥为:Computer明文为:MynameisZhuYunbeginningoftheSouthChinaUniversityofTechnologySoftwareEngineering,Zhaoqing,thestudents,thefirstphaseofthenewschoolcurriculumiscallednetworkinformationsecuritytechnology,classroomteacherisFengYuxiang.加密后的密文:OmcufikgObnPwbqyzmepwzvhjvvqMhykjOwcgeWbukykwzvmdzXvevzdfhkpGaunpeigQcabrvgfuca,Qjoafcgk,httlxlfszim,kjsuckwkdtpmxfhfwyrvyerbhscqgglbglniycltczxtxrvvkagemehcdbummfpetwnvzvmiyvleqzavs,tnoehlhsdhqpwaiiweZxrxMgmctrx.2、破译过程按照vigenère密码技术编写网页文件,代码以下:!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN==Content-Typecontent=text/html;charset=gbk/metahttp-equiv=Page-Entercontent=revealTrans(Duration=2,Transition=23)metahttp-equiv=Page-Exitcontent=revealTrans(Duration=2,Transition=23)2title维吉尼亚(Vigenère)密码/titlestylebody{font-size:18px;font-family:楷体_GB2312,仿宋_GB2312;}caption{text-align:center;font-size:20px;font-weight:bold;}center{font-size:28px;font-weight:bold;}.matrix{border:#BBBBFFsolidthick;cursor:pointer;}.matrixtd{width:18px;height:18px;border:#aaccaa1pxsolid;text-align:center;}.matrixth{width:18px;height:18px;border:#DDDDFF1pxsolid;background-color:#EEEEFF;text-align:center;}.cal{padding:20px20px20px20px;}.caltd,th{border-width:0px;}/style/headscriptlanguage=javascript//-----------声明全局变量--------------varAU=A.charCodeAt(0);//大写A的编码varAL=a.charCodeAt(0);//小写a的编码varZU=Z.charCodeAt(0);//大写Z的编码varZL=z.charCodeAt(0);//小写z的编码varcol1,col2;//方阵的列//--------------方阵函数---------functionwriteThead(){//方阵表头部document.writeln(theadtrth/th);for(vari=0;i26;i++){document.writeln(th+String.fromCharCode(AU+i)+/th);}document.writeln(/tr/thead);}functionforTo(i,j){//向前映射return(i+j)%26;}functionbackTo(i,j){//向后映射3return(i+26-j)%26;}functionwriteTbody(fun,id){//方阵体,传入映射函数和表编号//document.writeln(colgroupspan='26');for(vari=0;i=26;i++){document.writeln(col/);}//document.writeln(/colgroup);document.writeln(tbody);for(vari=0;i26;i++){document.writeln(tronmouseover='this.style.backgroundColor=\#DDDDff\'onmouseout='this.style.backgroundColor=\\');document.writeln(th+String.fromCharCode(AU+i)+/th);for(varj=0;j26;j++){document.writeln(tdonmouseover='pointIn(+j+,col+id+)'onmouseout='pointOut(+j+,col+id+)'+String.fromCharCode(AU+fun(i,j))+/td);}document.writeln(/tr);}document.writeln(/tbody);}functioninitCols(){//初始化列向量col1=document.getElementById(matrix1).getElementsByTagName(col);col2=document.getElementById(matrix2).getElementsByTagName(col);}functionpointIn(j,cols){//鼠标处于j列时修改此列颜色cols[j+1].style.backgroundColor=#DDDDFF;}functionpointOut(j,cols){//鼠标移出j列时恢复此列颜色cols[j+1].style.backgroundColor=;}//------------------加密解密函数-----------functionisUpLetter(c){//判断是否为大写字符编码if(c=AU&&c=ZU)returntrue;elsereturnfalse;}functionisLowLetter(c){//判断是否为小写字符编码if(c=AL&&c=ZL)returntrue;elsereturnfalse;}functionisLetter(c){//判断是否为英文字符编码returnisUpLetter(c)||isLowLetter(c);}functionisLetterStr(s){//判断是否为英文字符串for(vari=0;is.length;i++){if(!isLetter(s.charCodeAt(i)))returnfalse;}returntrue;}functionjiami(){//加密函数varkey=document.form1.miyao.value.toLowerCase();if(!isLetterStr(key)){alert(密钥必须为全英文字符串!);document.form1.miyao.focus();returnfalse;}varexpress=document.form1.mingwen.value;varsecret=;4if(key.length==0)secret=express;else{varA;varee;for(vari=0;iexpress.length;i++){ee=express.charCodeAt(i);if(isUpLetter(ee))A=AU;elseif(isLowLetter(ee))A=AL;else{secret+=express.charAt(i);continue;}secret+=String.fromCharCode(A+((ee-A)+(key.charCodeAt(i%key.length))-AL)%26);}}document.form1.miwen.value=secret;}functionjiemi(){//解密函数varkey=document.form1.miyao.value.toLowerCase();if(!isLetterStr(key)){alert(密钥必须为全英文字符串!);document.form1.miyao.focus();returnfalse;}varsecret=document.form1.miwen.value;varexpress=;if(key.length==0)express=secret;else{varA;varse;for(vari=0;isecret.length;i++){se=secret.charCodeAt(i);if(isUpLetter(se))A=AU;elseif(isLowLetter(se))A=AL;else{express+=secret.charAt(i);continue;}express+=String.fromCharCode(A+((se-A)+26-(key.charCodeAt(i%key.length)-AL))%26);}}document.form1.mingwen.value=express;}/scriptbodyonload=initCols()center网络信息安全技术课程破译vigenère密码加密的密文作业/centerformname=form1tableclass=calwidth=70%border=5align=centercellpadding=0cellspacing=0caption/captiontrtdcolspan=3align=center密钥:inputname=miyaotype=textsize=100value=//td/trtrtdwidth=0%明文:br/textareaname=mingwencols=50rows=10/textarea/tdtdwidth=0%inputname=buttontype=buttonvalue=加密onclick=jiami()/br/inputtype=buttonname=Submit2value=解密onclick=jiemi()//tdtdwidth=0%密文:br/textareaname=miwencols=50rows=10/textarea/td/tr/table/formbr
本文标题:《网络信息安全技术》-实验报告-破译vigenère-密码加密的密文
链接地址:https://www.777doc.com/doc-5172252 .html