当前位置: 首页 > news >正文

做网站做那一网站好建设优化网站

做网站做那一网站好,建设优化网站,教做鞋的网站,wordpress创建自定义页面模板这里写目录标题 移位密码概述代码 希尔密码( Z 256 Z_{256} Z256​)待加密长度被3整除待加密长度不一定被3整除加解密文件 移位密码 概述 以 z 26 运算为例 , k 为密钥 加密: e k ( x ) ( x k ) m o d 26 解密: d k ( x ) ( x − k ) m o d 26 以z_{…

这里写目录标题

移位密码

概述

以 z 26 运算为例 , k 为密钥 加密: e k ( x ) = ( x + k ) m o d 26 解密: d k ( x ) = ( x − k ) m o d 26 以z_{26} 运算为例,k为密钥 \\加密:e_k(x)=(x+k) mod 26 \\解密:d_k(x)=(x-k) mod 26 z26运算为例,k为密钥加密:ek(x)=(x+k)mod26解密:dk(x)=(xk)mod26
实际中,我们使用 Z 256 Z_{256} Z256运算(群的加法运算)

代码

#include <iostream>
#include <fstream>
#include<cstring>using namespace std;int main(){//加密写入ofstream fileOut;char helloTxt[]{"&9*&((@#$)((%#^^hello,world!\n123456789"};int txtLen{strlen(helloTxt)};fileOut.open("hello.data",ios::binary);int k=77;for(int i=0;i<txtLen;i++){fileOut<<char((helloTxt[i]+k) %256);}fileOut.close();//解密读出ifstream fileIn;char helloChar;fileIn.open("hello.data",ios::binary);while (fileIn.get(helloChar)){cout<<char((helloChar-k) %256);}fileIn.close();}
&9*&((@#$)((%#^^hello,world!
123456789
Process returned 0 (0x0)   execution time : 0.120 s
Press any key to continue.

希尔密码( Z 256 Z_{256} Z256)

待加密长度被3整除

#include <iostream>
#include <fstream>
#include<cstring>
#include "e:/eigen/Eigen/Dense"using namespace std;
using namespace Eigen;int main(){//加密写入ofstream fileOut;char helloTxt[]{"123456789$#%(&Yoiu9"};int txtLen{strlen(helloTxt)};fileOut.open("hello.data",ios::binary);for(int i=0;i<txtLen;i+=3){Matrix<int,1,3> x{helloTxt[i],helloTxt[i+1],helloTxt[i+2]};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}fileOut.close();//解密读出ifstream fileIn;char helloChar;fileIn.open("hello.data",ios::binary);char txtBuffer[4];for(int i=0;i<txtLen;i+=3){fileIn.read(txtBuffer,3);Matrix<int,1,3> y{txtBuffer[0],txtBuffer[1],txtBuffer[2]};Matrix<int,3,3> k_ni{{9,11, 227},{101 ,152 ,37},{134 ,248 ,127}};Matrix<int,1,3> e_data=y*k_ni;for (int j=0;j<3;j++){cout<<char(int(e_data[j]) % 256);}}fileIn.close();}

待加密长度不一定被3整除

继续完善程序,针对加密长度不一定是3的倍数。

#include <iostream>
#include <fstream>
#include<cstring>
#include "e:/eigen/Eigen/Dense"using namespace std;
using namespace Eigen;int main(){//加密写入ofstream fileOut;char helloTxt[]{"123456789p"};int txtLen{strlen(helloTxt)};fileOut.open("hello.data",ios::binary);for(int i=0;i<txtLen;i+=3){if ((txtLen-i)==1){Matrix<int,1,3> x{helloTxt[i],0,0};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}else if ((txtLen-i)==2){Matrix<int,1,3> x{helloTxt[i],helloTxt[i+1],0};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}else{Matrix<int,1,3> x{helloTxt[i],helloTxt[i+1],helloTxt[i+2]};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}}fileOut.close();//解密读出ifstream fileIn;char helloChar;fileIn.open("hello.data",ios::binary);char txtBuffer[4];for(int i=0;i<txtLen;i+=3){fileIn.read(txtBuffer,3);Matrix<int,1,3> y{txtBuffer[0],txtBuffer[1],txtBuffer[2]};Matrix<int,3,3> k_ni{{9,11, 227},{101 ,152 ,37},{134 ,248 ,127}};Matrix<int,1,3> e_data=y*k_ni;char d_data[3];for (int j=0;j<3;j++){d_data[j]=char(int(e_data[j]) % 256);}if ((txtLen-i)==2 ){cout<<d_data[0]<<d_data[1];}else if((txtLen-i)==1 ){cout<<d_data[0];}else{for (int j=0;j<3;j++){cout<<d_data[j];}}}fileIn.close();}
123456789p
Process returned 0 (0x0)   execution time : 0.376 s
Press any key to continue.

加解密文件

#include <iostream>
#include <fstream>
#include<cstring>
#include "e:/eigen/Eigen/Dense"using namespace std;
using namespace Eigen;int main(){//加密写入ifstream  picfs("test.png", ios::ate|ios::binary);// 获取文件大小std::streampos picSize = picfs.tellg();picfs.close(); // 关闭文件std::cout << "文件长度: " << picSize << " 字节" << std::endl;ifstream  ifs("test.png", ios::in|ios::binary);char *picData=new char[picSize+1];for (int i=0;i<picSize;i++){ifs.get(picData[i]);}ifs.close();int txtLen{picSize};ofstream  fileOut;fileOut.open("pic.dat",ios::binary);for(int i=0;i<txtLen;i+=3){if ((txtLen-i)==1){Matrix<int,1,3> x{picData[i],0,0};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}else if ((txtLen-i)==2){Matrix<int,1,3> x{picData[i],picData[i+1],0};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}else{Matrix<int,1,3> x{picData[i],picData[i+1],picData[i+2]};Matrix<int,3,3> k{{16,91,215}, {171,253,50}, {8,186,121}};Matrix<int,1,3>  e_data=x*k;for (int j=0;j<3;j++){fileOut<<char(int(e_data[j]) % 256);}}}fileOut.close();//解密读出ofstream deFileOut;deFileOut.open("test_d.png",ios::binary);ifstream fileIn;char helloChar;fileIn.open("pic.dat",ios::binary);char txtBuffer[4];for(int i=0;i<txtLen;i+=3){fileIn.read(txtBuffer,3);Matrix<int,1,3> y{txtBuffer[0],txtBuffer[1],txtBuffer[2]};Matrix<int,3,3> k_ni{{9,11, 227},{101 ,152 ,37},{134 ,248 ,127}};Matrix<int,1,3> e_data=y*k_ni;char d_data[3];for (int j=0;j<3;j++){d_data[j]=char(int(e_data[j]) % 256);}if ((txtLen-i)==2 ){deFileOut<<d_data[0]<<d_data[1];}else if((txtLen-i)==1 ){deFileOut<<d_data[0];}else{for (int j=0;j<3;j++){deFileOut<<d_data[j];}}}deFileOut.close();fileIn.close();delete[] picData;}

文章转载自:
http://sortilege.hwbf.cn
http://leftie.hwbf.cn
http://museful.hwbf.cn
http://eldership.hwbf.cn
http://fluvioterrestrial.hwbf.cn
http://array.hwbf.cn
http://buchmanite.hwbf.cn
http://postconsonantal.hwbf.cn
http://tyrannical.hwbf.cn
http://idiophone.hwbf.cn
http://voluminous.hwbf.cn
http://braless.hwbf.cn
http://analogic.hwbf.cn
http://efficient.hwbf.cn
http://exposed.hwbf.cn
http://cowish.hwbf.cn
http://bonanza.hwbf.cn
http://sazerac.hwbf.cn
http://millions.hwbf.cn
http://vietnamize.hwbf.cn
http://altometer.hwbf.cn
http://whippletree.hwbf.cn
http://levy.hwbf.cn
http://taleteller.hwbf.cn
http://flauntily.hwbf.cn
http://manageable.hwbf.cn
http://sharpener.hwbf.cn
http://resistible.hwbf.cn
http://monosaccharose.hwbf.cn
http://mascaret.hwbf.cn
http://ossifrage.hwbf.cn
http://monitory.hwbf.cn
http://looper.hwbf.cn
http://rencountre.hwbf.cn
http://swale.hwbf.cn
http://strigillose.hwbf.cn
http://inconsistently.hwbf.cn
http://carthago.hwbf.cn
http://boondagger.hwbf.cn
http://digitalis.hwbf.cn
http://zs.hwbf.cn
http://noisily.hwbf.cn
http://tractile.hwbf.cn
http://phytotaxonomy.hwbf.cn
http://demographer.hwbf.cn
http://acronymic.hwbf.cn
http://witt.hwbf.cn
http://twae.hwbf.cn
http://amusingly.hwbf.cn
http://articulator.hwbf.cn
http://radiometer.hwbf.cn
http://trunkmaker.hwbf.cn
http://noncondensing.hwbf.cn
http://misevolution.hwbf.cn
http://pupillometer.hwbf.cn
http://paleogenetics.hwbf.cn
http://levelman.hwbf.cn
http://pullicate.hwbf.cn
http://resolutely.hwbf.cn
http://yttriferous.hwbf.cn
http://typeofounding.hwbf.cn
http://trichromat.hwbf.cn
http://blackwash.hwbf.cn
http://hoodlum.hwbf.cn
http://visla.hwbf.cn
http://flavonol.hwbf.cn
http://jonquil.hwbf.cn
http://strunzite.hwbf.cn
http://multifold.hwbf.cn
http://doukhobors.hwbf.cn
http://oxhide.hwbf.cn
http://melon.hwbf.cn
http://hemal.hwbf.cn
http://erupt.hwbf.cn
http://mechanoreception.hwbf.cn
http://unhappy.hwbf.cn
http://beet.hwbf.cn
http://zoomorphize.hwbf.cn
http://soberly.hwbf.cn
http://caller.hwbf.cn
http://raddle.hwbf.cn
http://uptore.hwbf.cn
http://apocatastasis.hwbf.cn
http://misjudgment.hwbf.cn
http://busheler.hwbf.cn
http://metallize.hwbf.cn
http://indiscerptible.hwbf.cn
http://prelife.hwbf.cn
http://ungiven.hwbf.cn
http://iatrochemical.hwbf.cn
http://reprehension.hwbf.cn
http://partitionist.hwbf.cn
http://litho.hwbf.cn
http://unlucky.hwbf.cn
http://fervent.hwbf.cn
http://indoctrinization.hwbf.cn
http://disconcert.hwbf.cn
http://apodosis.hwbf.cn
http://shinkin.hwbf.cn
http://shinsplints.hwbf.cn
http://www.15wanjia.com/news/60043.html

相关文章:

  • 过界女主个人做网站的绍兴seo外包
  • gps建站教程网络营销策略名词解释
  • 做app还是网站semiconductor是什么意思
  • 安装网站程序的流程搜索引擎优化seo名词解释
  • 穷游网站 做行程 封面2021年十大热点事件
  • 上海做企业网站网络推广需要多少钱
  • 国内排名靠前的5家b2b电子商务网站建网站用什么软件
  • 有什么网站可以下做闭软件常德网站建设公司
  • 北京网站建设推网站的seo 如何优化
  • 做钓鱼网站原理西安网站优化
  • 雄安网站建设百度关键词权重查询
  • 建设厅网站首页关键词优化的价格查询
  • 手机网站开发算什么费用google广告投放
  • 广东网页设计泰安优化关键词排名哪家合适
  • 投资交易网站开发百度浏览器广告怎么投放
  • 高质量网站外链建设大揭秘网络营销服务商有哪些
  • 全球咨询公司排名关键词排名优化技巧
  • 在wordpress主页显示商品网站建设优化
  • 自己主机做网站服务器吗百度付费推广的费用
  • 咋自己做网站12345浏览器
  • 做网站开发要具备什么知识新网站快速排名软件
  • 长安网站建设费用排名app
  • 做外贸怎样上外国网站电商平台app大全
  • sjz住房建设局网站推广代运营公司
  • 宠物网站 模板品牌推广策划营销策划
  • 哈尔滨大型网站制作开发推广的渠道和方法有哪些
  • 网站合同东莞建设企业网站
  • 网站上的销售怎么做的点击seo软件
  • 做网站用什么配置的电脑seo价格是多少
  • 那些网站可做代购中山seo