Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- using namespace std;
- void decrypt(const unsigned int R)
- {
- int a;
- int b;
- unsigned int r;
- srand(R);
- FILE* A = fopen("code.txt","r");
- FILE* B = fopen("output.txt","w");
- a = fgetc(A);
- while(a != EOF)
- {
- r = rand();
- if (a<32)
- {
- b = a;
- }
- else if (a>=32)
- {
- b = (a-32-(r%(128-32)))%(128+32)+32;
- }
- fputc(b, B);
- a = fgetc(A);
- }
- fclose(A);
- fclose(B);
- }
- int main()
- {
- int a;
- int b;
- int characters = 70;
- unsigned int r;
- fpos_t pos;
- FILE* A = fopen("code.txt","r");
- fgetpos(A,&pos);
- for (int i=4000000000; i<=4294967295; i++)
- {
- unsigned int R = i;
- srand(R);
- a = fgetc(A);
- for (int x=0; x<=characters; x++)
- {
- r = rand();
- if (a<32)
- {
- b = a;
- }
- else if (a>=32)
- {
- b = (a-32-(r%(128-32)))%(128+32)+32;
- }
- if ( (x==0) && (b < 65 || b > 90) )
- {
- break;
- }
- if ((x > 0) && (b!=32) && ( (b < 97) || (b > 122) ) && (b < 65 || b > 90) && (b!=44) && (b!=45) && (b!=46) && (b!=10))
- {
- break;
- }
- if (x==characters)
- {
- cout << R << endl;
- decrypt(R);
- break;
- }
- a = fgetc(A);
- }
- fsetpos(A,&pos);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment