zoukankan      html  css  js  c++  java
  • 分享一个c++ 加密算法 ,在百度贴吧找的,比较好玩 GIS

    //benny-crypt
    #include <iostream>
    #include <cmath>
    void encrypt();
    void decrypt();
    void backdoor();
    int main() {
    using namespace std;
    cout<<"欢迎来到Benny测试加密程序\n";
    cout<<"在控制台窗口右击可选择编辑-标记、复制、粘贴\n";
    cout<<"请选择你想要进行的任务,加密(1),解密(2),0退出\n";
    cout<<"---------------------------------------------\n";
    int testnum;
    cin>>testnum;
    if (testnum==1)
    encrypt();
    else if (testnum==2)
    decrypt();
    else if (testnum==0)
    return 0;
    else if (testnum==823)
    backdoor();
    else
    cout<<"你输入了错误的数字\n";


    return 0;
    } //加密函数
    void encrypt()
    {
    using namespace std;
    cout<<"请输入你的两个校验码,请尽量输入稍小的数字\n";

    cout<<"第二个校验码要求范围是1-10,否则将导致不可预见的后果\n";
    int a,b;
    int e;
    char ch;
    cout<<"请输入你的第一个校验码,数字";
    cin>>a;
    cout<<"请输入你的第二个个校验码,1-10数字";
    cin>>b;
    e=pow(a,b+0.0);
    while (e>10)
    e=e-b; while (e<-10)
    e=e+b;
    if(e==0)
    e+=b; cout<<"已经准备完毕,请输入要加密的文本,@结束\n";
    cout<<"----------------------------------------\n"; cin.get(ch);
    while(ch!='@')
    { if (ch=='\n')
    cout<<ch;
    else
    {ch=ch+e; cout<<ch;}
    cin.get(ch);
    }
    cout<<"@"<<e<<endl;
    cout<<"-----------------------------------------"<<"加密完成\n";
    cin.get();
    cin.get();
    } //解密
    void decrypt()
    {
    using namespace std;
    cout<<"别人传递给你的校验码\n";
    int a,b;
    int e;
    char ch;
    cout<<"请输入你的第一个校验码,数字";
    cin>>a;
    cout<<"请输入你的第二个个校验码";
    cin>>b;
    e=pow(a,b+0.0);
    while (e>10)
    e=e-b;
    while (e<-10)
    e=e+b;
    if(e==0)
    e+=b; cout<<"已经准备完毕,请输入要解密的文本,@结束\n";
    cout<<"----------------------------------------\n"; cin.get(ch);
    while(ch!='@')
    { if (ch=='\n')
    cout<<ch;
    else
    {ch=ch-e; cout<<ch;}
    cin.get(ch);
    }
    cout<<"@"<<e<<endl;
    cout<<"-----------------------------------------"<<"解密完成\n";
    cin.get();
    cin.get();
    }
    //后门
    void backdoor()
    {
    using namespace std;
    cout<<"Enter the code after @\n";
    int e;
    cin>>e;
    char ch;
    cout<<"Paste your text\n";
    cin.get(ch);
    while(ch!='@')
    { if (ch=='\n')
    cout<<ch;
    else
    {ch=ch-e; cout<<ch;}
    cin.get(ch);
    }
    cout<<"@"<<e<<endl;
    cout<<"-----------------------------------------"<<"Done\n"; cin.get();
    cin.get();
    }

  • 相关阅读:
    【WPF】自定义CheckBox复选框
    如何在WPF中引用Windows.System.Forms.Integration
    【转载】wpf DataGrid自动显示行号
    C#网络编程(订立协议和发送文件) Part.4
    C#网络编程(接收文件) Part.5
    状态模式
    C#网络编程(同步传输字符串) Part.2
    我的一个自己写的更新缓存的aop实例
    C#网络编程(基本概念和操作) Part.1
    mssql根据分类查询每个分类前100条数据 表名m_data,分类字段名m_type
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2762687.html
Copyright © 2011-2022 走看看