I really feel stupid for posting this but since i got no answers on my question and i am still junior programmer i will post this :
//List of keys
byte[] Key0 = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; //mode 10 = 0
byte[] Key1 = { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 }; // i + 2
byte[] Key2 = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; // i mode 2 = 0
byte[] Key3 = { 66, 77, 88, 99, 111, 222, 110, 112, 114, 115 }; // mode 11 = 0
byte[] Key4 = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 }; //x^2
byte[] Key5 = { 6,17,34,57,86,121,162,209 }; //3x^2+2x+1
byte[] Key6 = { 77,78,79,80,81,82,83,84,85,86,87 }; // only in range
//Add all keys to the list
List<byte[]> oKeysList = new List<byte[]>();
oKeysList.Add(Key0);
oKeysList.Add(Key1);
oKeysList.Add(Key2);
oKeysList.Add(Key3);
oKeysList.Add(Key4);
oKeysList.Add(Key5);
oKeysList.Add(Key6);
Random oRandom = new Random();
//Generate random key index to be used in the encryption
int ListSelectedIndex = oRandom.Next(0, oKeysList.Count);
byte[] GeneratedKey = oKeysList[ListSelectedIndex];
//Generate 3 random number from the selected key and concate the key index to it
byte[] GeneratedBytes = new byte[4];
for (int i = 0; i < 3; i++)
{
GeneratedBytes[i] = GeneratedKey[oRandom.Next(0,GeneratedKey.Length)];
}
//Add the list of key index
GeneratedBytes[3] = (byte)ListSelectedIndex;
//Return the genreated bytes
return GeneratedBytes;
As you see i generate this 4 byte array along with a 8 bytes generated with from RNG Cryptography, and when i want to check my serial i take the last 4 bytes and use the mathematical relations between them, I want to generate many serials and be able to check if they are valid or not. I know its probably pretty old method with a very bad security so please if any one could help me or add anything to my code or suggest anything new i would be really thankful.
I am not sure that anyone will analyze your code here. I suggest the following: do not make software protection too complex. It won't make a significant affect on piracy, but 100% will affect people, who purchased your software. Keep your software protection mechanisms as simple as possible.