HI,
For my application i want to create a license key, i have two method
(1) Using any id in client machine (like get hard disk id) php generate licence key
in brief client send they hard disk id , using this i will generate a unlock key for my product and send back to this client. By submitting this id,my application check the unlock key which i sent and system generate (both me and my application use same logic) right it wrong
(2) I have generate set of some unlock keys and of the key is given to id, after using this client may unlock/ to give a license key to my product..
(3) If is there any solutions please give
any one give the idea , how do to this?
If your application does not need hyper secure keys, you could go for a easier method.
To generate the key :
1) Ask the user to give you a username (5 or more characters is good).
2) Take that username and do something (optional),
2.1) That something could be : shift all the letter right or left.
2.2) That something could be : exchange the last 2 letters with the first 2.
2.3) Ect.
3) Add a salt to the username (Important!). IE: $username.'thisIsTheSalt';
4) Use MD5 or any other hash function to generate a "key" for you.
4.1) You can take only a subset of the generated hash.
To check if the user-typed key is valid :
1) Have a box for the user to enter his username and key.
2) Do the exact same computation.
3) Check if the computed key match the user-entered key.
Adding the salt and, if you want, shifting the letters in the username will obfuscate the generated MD5 well enough.
No one should be able to guess that in order to generate a valid key he will need to shift all the letters in his username three positions and then add 'tigersAreCute' to the string and the MD5 the string and then do substr(5,13).
It's not perfect, but in most applications, this approach is more than enough.