一个简单的加密代码【博客食用更佳】求大佬改进
  • 板块学术版
  • 楼主荒凌
  • 当前回复1
  • 已保存回复1
  • 发布时间2020/12/1 21:32
  • 上次更新2023/11/5 06:56:06
查看原帖
一个简单的加密代码【博客食用更佳】求大佬改进
370768
荒凌楼主2020/12/1 21:32

因为我实在是太蒟蒻了,所以就在这直接放出蒟蒻的代码了https://blog.csdn.net/weixin_43903850/article/details/110448365

#include<bits/stdc++.h>
#include<windows.h>
#define h 37301231
#define u 30724313
#define s 70654554
#define o 98745554
#define N 102040000
#include<time.h>
using namespace std;
int wei(int x){
	int sum=0;
	if(x==0)return 1;//为0的时候也是一位 
	while(x>0)sum++,x/=10;
	return sum;
}//计算位数的函数 
int qiu(long long a,long long b){
	for(long long i=0;i<=N;i++){
		if(((i%h)*u==a)&&((i%s)*o==b)){
			cout<<i;
			break;//理论上应该是碰不见longlong以内的相同的了
			//为了算法优化便直接退出了 
		}
	}
}
int main(){
	int bits=0;
	long long a,b;
	int x=0;int z;
//	srand(time(NULL));//随机数种子,采用时间(不同种子产生不同随机组合)
	//这里得在循环之外 
	while(1){
	system("cls");//清屏 
//	a=rand()%N+100000000;       // random number 1-10b=a;
	cin>>a;//9位 以内能暴力解出,超9位(long内)依然正常输出结果
	//可以更改N值来提高暴力的数量 
    cout<<"a:"<<a<<endl;b=a;cout<<"Bc:"<<bits;
	a%=h;a*=u;//运算 
	b%=s;b*=o;
	cout<<"|---------------This is the first keys\n";
	cout<<a<<' '<<b<<endl;
	cout<<"|----This is the secound key\n";
	cout<<char(wei(a)-1+'a')<<a<<char(wei(b)-1+'a')<<b<<endl;
	//一个错误的算法 
	cout<<"|-------------ans is|";
	bits++;//计数器没啥用 
	qiu(a,b);//暴力求解 
	cout<<endl;
	cout<<"Nothing WARN\n---------------------------------------";
	system("pause");//任意继续 
	}
	cout<<"WWWWWWW"<<' '<<x;
	return 0;
}
2020/12/1 21:32
加载中...