initial commit

This commit is contained in:
josch 2014-06-26 10:38:33 +02:00
commit 6dc12ce2f6

87
sckey.cpp Normal file
View file

@ -0,0 +1,87 @@
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
void generate(vector<int>& s, int& x, int& d)
{
//Stores random digits 0-9 in a vector
for (int i = 0; i < 12; i++)
{
s[i] = rand() % 10;
s[i] = 0;
}
s[0] = 1;
s[1] = 3;
s[2] = 3;
s[3] = 7;
s[4] = 1;
s[5] = 3;
s[6] = 3;
s[7] = 7;
s[8] = 1;
s[9] = 3;
s[10] = 3;
s[11] = 7;
//Main algorithm
for(int i = 0; i < 12; i++)
{
d = (2 * x) xor s[i];
x = x + d;
}
x = x % 10;
for(int i = 0; i < 12; i++)
{
if(i==4)
{
cout << '-' << s[i];
}
else if (i==9)
{
cout << '-' << s[i];
}
else cout<<s[i];
}
cout << x;
x=3;
d=0;
}
int main()
{
srand(static_cast<int>(time(0)));
vector<int> serial(12);
int eax = 3;
int edi = 0;
int a;
bool no_quit = true;
cout << "Starcraft CD keygen\n";
generate(serial,eax,edi);
do
{
cout << "\nGenerate another one? (yes=1/no=0)";
cin >> a;
if (a==1) generate(serial,eax,edi);
else no_quit=false;
}
while(no_quit);
return 0;
}