Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- char oText[] = {71, 114, 101, 97, 116, 32, 87, 111, 114, 107, 33};
- char kText[] = {70, 97, 105, 108, 101, 100, 33, 32, 84, 114, 121, 32, 105, 116, 32, 97, 110, 111, 116, 104, 101, 114, 32, 116, 105, 109, 101, 33};
- char uText[] = {85, 115, 101, 114, 58, 32};
- char pText[] = {80, 97, 115, 115, 119, 58, 32};
- void WriteInfo()
- {
- cout << "------------ Welcome to CrackMe1 ------------" << endl;
- cout << "| |" << endl;
- cout << "| Objectives: |" << endl;
- cout << "| 1. Patch me for any key |" << endl;
- cout << "| 2. Create a keygen |" << endl;
- cout << "| 3. Create a DLL to patch me |" << endl;
- cout << "| |" << endl;
- cout << "-------------- The game starts --------------" << endl;
- cout << endl;
- }
- int GetUser()
- {
- string user;
- cout << uText;
- cin >> user;
- int result1 = 0;
- int result2 = 0;
- for (int i=0; i < user.length(); ++i)// Makes a XOR between the char and (user.length()-i)*7 and addit to result1
- {
- int value = 0;
- value = user[i];
- result1 += value ^ (user.length() - i)*7;
- }
- while (result1 != 0) // Reverse the value of result1 and changes individual values for his "opposite"
- {
- result2 = 10 - (result1 % 10);
- result1 = result1/10;
- result2 = result2*10;
- }
- return result2;
- }
- string TransformPassw(string& passw) //Transforms the passw. If a number or char, rests 1, else convert the char to a char number
- {
- for (int i=0; i < passw.length(); ++i)
- {
- if( (passw[i] >= 48 && passw[i] <= 57) || (passw[i] >= 65 && passw[i] <= 90) || (passw[i] >= 97 && passw[i] <= 122) )
- {
- switch(passw[i])
- {
- case 48: passw[i] = 57; break;
- case 65: passw[i] = 122; break;
- case 97: passw[i] = 90; break;
- };
- }
- else passw[i] = 48 + (passw[i] % 10);
- }
- return passw;
- }
- int GetPassw()
- {
- string passw;
- cout << pText;
- cin >> passw;
- int pairs = 1;
- int odds = 1;
- passw = TransformPassw(passw);
- for (int i=1; i < passw.length(); i += 2)
- {
- int value = passw[i-1];
- passw[i-1] = passw[i];
- passw[i] = value;
- pairs *= passw[i-1] / 10;
- odds *= passw[i] % 10;
- }
- return (pairs+odds);
- }
- bool CompareValues(int user, int passw)
- {
- bool resul = ((user ^ 1234) == (passw ^ 4321));
- if (resul) cout << oText << endl;
- else cout << kText << endl;
- return resul;
- }
- int main()
- {
- WriteInfo();
- bool reg = false;
- while (!reg)
- {
- int user = GetUser();
- int passw = GetPassw();
- reg = CompareValues(user, passw);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement