Home > Back-end >  Share a C serial number generator, commonly known as "the keygen"
Share a C serial number generator, commonly known as "the keygen"

Time:01-30

//KSWPSSN. CPP: Defines the entry point for the console application. 
//

# include "stdafx. H"
#include
#include
#include

Void GetByte (char * dest, char * SRC, unsigned pos)
{
* dest=SRC (pos),
}

Void SetByte (unsigned char * dest, pos, char value)
{
Dest [pos]=value;
}

Int valsn (char * lString2, char * lString3, char * lString4)
{
Char lString6 [20].
Char lString7 [20].
Char lNumber5;
Char lNumber2;
Char lNumber3;
Char lNumber6;
Char lNumber4;
Char lNumber7;
GetByte (& amp; LNumber5 lString4, 3);
LNumber5=105 - lNumber5;
SetByte (lString6, 7, lNumber5);
GetByte (& amp; LNumber5, lString3, 2);
LNumber5=105 - lNumber5;
SetByte (lString6, 6, lNumber5);
GetByte (& amp; LNumber5 lString6, 6);
LNumber5=lNumber5-48;
LNumber2=7 * lNumber5;
LNumber2=lNumber2%10;
GetByte (& amp; LNumber5, lString4, 1);
LNumber3=lNumber5-48;
LNumber5=lNumber3 & lt; LNumber2;
If (lNumber5!=0)
LNumber3=lNumber3 + 10;
LNumber5=lNumber3 - lNumber2;
LNumber5=48 + lNumber5;
SetByte (lString6, 5, lNumber5);
GetByte (& amp; LNumber5 lString6, 6);
LNumber5=lNumber5-48;
LNumber2=3 * lNumber5;
LNumber2=lNumber2%10;
GetByte (& amp; LNumber5 lString4, 4);
LNumber3=lNumber5-48;
LNumber5=lNumber3 & lt; LNumber2;
If (lNumber5!=0)
LNumber3=lNumber3 + 10;
LNumber5=lNumber3 - lNumber2;
LNumber5=48 + lNumber5;
SetByte (lString6, 4, lNumber5);
GetByte (& amp; LNumber5, lString3, 0);
LNumber5=lNumber5-48;
GetByte (& amp; LNumber6 lString6, 7);
LNumber6=lNumber6-48;
LNumber2=lNumber5 + lNumber6;
LNumber5=lNumber2%10;
LNumber5=48 + lNumber5;
SetByte (lString6, 3, lNumber5);
GetByte (& amp; LNumber5 lString6, 7);
LNumber5=lNumber5-48;
LNumber2=2 * lNumber5;
LNumber2=lNumber2%10;
GetByte (& amp; LNumber5 lString3, 4);
LNumber3=lNumber5-48;
LNumber5=lNumber3 & lt; LNumber2;
If (lNumber5!=0)
LNumber3=lNumber3 + 10;
LNumber5=lNumber3 - lNumber2;
LNumber5=48 + lNumber5;
SetByte (lString6, 2, lNumber5);
GetByte (& amp; LNumber5 lString6, 7);
LNumber5=lNumber5-48;
LNumber2=7 * lNumber5;
LNumber2=lNumber2%10;
GetByte (& amp; LNumber5, lString3, 1);
LNumber3=lNumber5-48;
LNumber5=lNumber3 & lt; LNumber2;
If (lNumber5!=0)
LNumber3=lNumber3 + 10;
LNumber5=lNumber3 - lNumber2;
LNumber5=48 + lNumber5;
SetByte (lString6, 1, lNumber5);
GetByte (& amp; LNumber5 lString6, 7);
LNumber5=lNumber5-48;
LNumber2=3 * lNumber5;
LNumber2=lNumber2%10;
GetByte (& amp; LNumber5, lString4, 0);
LNumber3=lNumber5-48;
LNumber5=lNumber3 & lt; LNumber2;
If (lNumber5!=0)
LNumber3=lNumber3 + 10;
LNumber5=lNumber3 - lNumber2;
LNumber5=48 + lNumber5;
SetByte (lString6, 0, lNumber5);
LNumber4=0;
LNumber2=0;
While (lNumber2 & lt;=7)
{
GetByte (& amp; LNumber5 lString6, lNumber2);
LNumber5=lNumber5-48;
LNumber4=lNumber4 + lNumber5;
LNumber2=lNumber2 + 1;
}
GetByte (& amp; LNumber5 lString2, 3);
LNumber5=lNumber5-48;
LNumber4=lNumber4 + lNumber5;
GetByte (& amp; LNumber5 lString2, 4);
LNumber5=lNumber5-48;
LNumber4=lNumber4 + lNumber5;
LNumber4=lNumber4%100;
LNumber5=lNumber4/10;
LNumber5=lNumber5 + 48;
SetByte (lString7, 0, lNumber5);
LNumber5=lNumber4%10;
LNumber5=lNumber5 + 48;
SetByte (lString7, 1, lNumber5);
GetByte (& amp; LNumber5, lString7, 0);
GetByte (& amp; LNumber6 lString3, 3);
LNumber5=lNumber5!=lNumber6;
GetByte (& amp; LNumber6, lString7, 1);
GetByte (& amp; LNumber7, lString4, 2);
LNumber6=lNumber6!=lNumber7;
LNumber5=lNumber5 | | lNumber6;
Return lNumber5==0;
}

Int _tmain (int arg c, _TCHAR * argv [])
{
Char s1 [6]="KSW00";
Char s2 [6]="00000";
Char s3 [6]="00000";
Srand ((unsigned) time (NULL));
for (int i=0; I & lt; 100; I++)
{
Int se=rand () % 100000;
S2 [0]=se/10000% 10 + '0';
S2 [1]=se/1000% 10 + '0';
S2 [2]=se/100% 10 + '0';
S2 [3]=se/10% 10 + '0';
S2 [4]=10 + se % '0'.
Int the sta=0;
While (sta & lt; 100000)
{
S3 [0]=sta/10000% 10 + '0';
S3 [1]=sta/1000% 10 + '0';
S3 [2]=sta/100% 10 + '0';
S3 [3]=sta/10% 10 + '0';
S3 [4]=sta % 10 + '0';
Int result=valsn (s1, s2, s3);
If (result)
{
Printf (" % s to % s to % s \ n ", s1, s2, s3);
break;
}
Sta++;
}
}
system("pause");
return 0; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related