I know there are several ways of creating a free trials. My algorithm that I have thought is as follows:
-
get something that identifies the computer where the application is installed. lets say I chose to get the windows product ID which may look something like: 00247-OEM-8992485-00078.
-
then hash that string and say I end up with the string: ckeer34kijr9f09uswcojskdfjsdk
-
then create a file with random letters and numbers something that looks like:
ksfjksdfjs98w73899wf89u289uf9289frmu2f98um98ry723tyr98re812y89897982433mc98lpokojiaytfwhjdegwdehjhdjwhbdwhdiwhd78ey8378er83r78rhy378wrgt37678er827yhe8162e682eg8gt66gt…..etc
-
then on the file that was random generated find the second number (in this case is 8) also find the last number (in this case it is 6) now multiply those numbers and you get 48: then that will be the position where I will start putting the hash string that I got which if you recall was: ckeer34kijr9f09uswcojskdfjsdk so the 48 character of the file happens to be a ‘f’ so replace that ‘f’ with the first character of the hash string which is c. so replace the f for c. then move two characters to the right to possition 50 and place the next hash string character etc…
-
I could also encrypt the file and unencrypt it in order to be more secure.
-
every time the user opens the program check that file and see if it follows the algorith. if it does not follow the algorithm then it means it is not a full version program.
so as you can see I just need to get something unique about the computer. I thought about getting the windows product key which that I think will be unique but I don’t know how to get that. Another thing that I thought was getting the mac address. But I don’t think that it is efficient because if the user changes it’s nic card then the program will not work. Any information that is unique about the computer will help me a lot.
I know a lot of companies use the MAC address for this. I’m not sure what pros and cons there are to this approach, but it’s worth looking into.
I believe you can use a method like this to get the MAC address:
This SO question discusses it in detail: Reliable method to get machine's MAC address in C#
EDIT
As others have pointed out, MAC address is not guaranteed to be unique. After doing a little more research, there are a couple of other options which might work better. The two that stuck out to me are:
Get processor serial number:
Get HDD serial number: