

Kod:
#include
#include
#include
#include
int
getdigit(int num, int n)
{
int r;
r = num / pow(10, n);
r = r % 10;
return r;
}
int
sum_of_digits (int number)
{
int temp = number;
int sum = 0;
while (temp)
{
sum += temp % 10;
temp /= 10;
}
return sum;
}
int
first_segment ()
{
int min = 1;
int max = 999;
int xxx = min + rand() % (max-min);
int last;
last = getdigit(xxx, 0) + 1;
return xxx * 10 + last;
}
int
second_segment ()
{
int xxxxxx;
int sum;
int last;
do
{
xxxxxx = rand() % 1000000;
sum = sum_of_digits(xxxxxx);
last = 7-(sum%7);
}
while(last == 0 || last == 8);
return xxxxxx * 10 + last;
}
int
main (int argc, char *argv[])
{
srand (time (NULL));
int firstse = first_segment (), secondse = second_segment ();
printf ("[+] 11 Digit CD Serial Key > %04d-%07d\n", firstse, secondse);
return EXIT_SUCCESS;
}