I have isolated the algorithm of a keygenme, but I am running into difficulty with creating the keygen.
The key has a length of seven digits, and the sum of each of the digits in the key must be divisible by seven and leave no remainder.
For example, the key 54135111 is valid since 5+4+1+3+5+1+1+1=21, and 21 is divisible by 7 with 0 remainder.
The way I am currently implementing the keygen is as follows:
1. Generate a seven-digit random number.
2. Check if that number is valid.
3. If it valid, display it to the user; if it is not valid, start over.
Is there a way in which I can more efficiently generate valid keys without having to inefficiently generate random numbers? I am using VB.NET/C#.
x = any 6-digit number... 7-digit number = 10*x + mod(x, 7) ... Not mod(), but mod(sum()) ... you get the idea.