ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

License Key Generator



sn00p

ClioSport Club Member
  A blue one.
disco, your mod is the wrong way round - Should be equal to zero as no remainder means it divisible by 65.

edit: ignore me, just noticed your loops are while not valid.....d'oh.
 
When it is divisiable by 65 it drops out the loop as it is a valid licence key. i.e. i want it to keep looping while the remainder is not = 0

So while (the check sum is not = 4095 and the remainder is not = 0) then keep generating numbers.
 
sn00p said:
disco, your mod is the wrong way round - Should be equal to zero as no remainder means it divisible by 65.

edit: ignore me, just noticed your loops are while not valid.....d'oh.

:) I think it can get quite confusing when using loops, ands, ors and nots together! You often get double negatives. Like (i want it to not loop when something is not equal to something!)
 
sn00p said:
I still like that 000-000-000-000-000-000 is a valid key! ;)

I think they have gotten round that passing the checksum div by 65 by saying each part of the key must be between 100 and 999
 

sn00p

ClioSport Club Member
  A blue one.
disco said:
I think they have gotten round that passing the checksum div by 65 by saying each part of the key must be between 100 and 999

Ahh. I missed that part of his post.

That sure would stop it!
 
Does it matter if the code generates more licence keys that are divisable by 65 than ones add up to 4095 as it appears to at the moment. I can add another small bit of randomisation to make sure it goes between the two types of key more regularly? Without working it out explicitly I think my code will hit more combinations that divide by 65 than add up to 4095. Perhaps simpy because there are more?

D

Code:
Dim licenceKey
Dim licenceKeyCheckSum
Dim intHighestNumber
Dim licenceKeyPart1
Dim licenceKeyPart2
Dim licenceKeyPart3
Dim licenceKeyPart4
Dim licenceKeyPart5
Dim licenceKeyPart6
Dim keyType

keyType = 0

intHighestNumber = 999
licenceKeyPart1 = 0
licenceKeyPart2 = 0
licenceKeyPart3 = 0
licenceKeyPart4 = 0
licenceKeyPart5 = 0
licenceKeyPart6 = 0

licenceKeyCheckSum = 1

licenceKey = ""

keyType = RandomNumber2(2)

If keyType = 1 then
	Do While (licenceKeyCheckSum <> 4095)
	
		licenceKeyPart1 = RandomNumber(intHighestNumber)
		licenceKeyPart2 = RandomNumber(intHighestNumber)
		licenceKeyPart3 = RandomNumber(intHighestNumber)
		licenceKeyPart4 = RandomNumber(intHighestNumber)
		licenceKeyPart5 = RandomNumber(intHighestNumber)
		licenceKeyPart6 = RandomNumber(intHighestNumber)
		
		licenceKeyCheckSum = licenceKeyPart1+licenceKeyPart2+licenceKeyPart3+licenceKeyPart4+licenceKeyPart5+licenceKeyPart6
	
	
	Loop 
Else
	Do While (licenceKeyCheckSum Mod 65 <> 0)
	
	    licenceKeyPart1 = RandomNumber(intHighestNumber)
		licenceKeyPart2 = RandomNumber(intHighestNumber)
		licenceKeyPart3 = RandomNumber(intHighestNumber)
		licenceKeyPart4 = RandomNumber(intHighestNumber)
		licenceKeyPart5 = RandomNumber(intHighestNumber)
		licenceKeyPart6 = RandomNumber(intHighestNumber)
		
		licenceKeyCheckSum = licenceKeyPart1+licenceKeyPart2+licenceKeyPart3+licenceKeyPart4+licenceKeyPart5+licenceKeyPart6
		
	Loop
End If

licenceKey = licenceKeyPart1&"-"&licenceKeyPart2&"-"&licenceKeyPart3&"-"&licenceKeyPart4&"-"&licenceKeyPart5&"-"&licenceKeyPart6

Function RandomNumber(intHighestNumber)
	Do While RandomNumber < 100
	  Randomize	
	  RandomNumber = Int(Rnd * intHighestNumber) + 1
	Loop
End Function

Function RandomNumber2(intHighestNumber)
	  Randomize	
	  RandomNumber2 = Int(Rnd * intHighestNumber) + 1
End Function

'WScript.Echo keyType
WScript.Echo licenceKey

Set licenceKey = Nothing
Set licenceKeyCheckSum = Nothing
Set intHighestNumber = Nothing
Set licenceKeyPart1 = Nothing
Set licenceKeyPart2 = Nothing
Set licenceKeyPart3 = Nothing
Set licenceKeyPart4 = Nothing
Set licenceKeyPart5 = Nothing
Set licenceKeyPart6 = Nothing
Set keyType = Nothing
 
Last edited:

sn00p

ClioSport Club Member
  A blue one.
bored disco?! me too. ;)

Code:
int main(void)
{
    int tuples[6];
    int i, j,k,generating=TRUE;

    for (i=0;i<6;i++)
        tuples[i] = 100;

    while(generating)
    {
        for (j=0,k=0;j<6;j++)
            k += tuples[j];

        if ( (k==4095) || ((k % 65)==0))
        {
            for (j=0;j<6;j++)
            {
                printf("%.3d", tuples[5-j]);

                if (j!=5)
                    printf("-");
            }

            printf("\r\n");
        }

        for (j=0;j<6;j++)
        {
            if (tuples[j]<=999)
            {
                tuples[j]++;

                if (tuples[j]>999)
                {
                    tuples[j]=100;

                    if (j==5)
                        generating = FALSE;

                }
                else
                    break;
            }
            else
                break;
        }
    }
}
 
Last edited:


Top