u first create ur own encryption formula or choose an encryption theory to use
then decide one or a set of valid keys
create an encrypt function in a separate program (this program will be used to generate serial no.s)
create a decrypt function in ur main java program (serial no will be decrypted with this function to see if matches with the valid key(s))
*to generate infinitely many serial no.s from a single key or a set of keys, u just have to include some free variables in ur encryption formula
when key matches, access flag will be set to 2 and be able to access all functionalities that u limited with IF(access>1){},
access 0 could be no access, 1 could be trial, 2 activated, 3 admin
don't have to store state in harddrive(waste of resource)
done
Example(simple):
using a simple multiplication encryption formula where it will multiple the key by n(free variable, could use random generator), set valid keys to be the set [3,5]
3, 5, 6, 9, 10, 66666, 4125151560, ..., would all be valid serial no., while 0, 1, 7, 11234452, ... would be invalid serial no.
then create a decryption function where it will basically perform {IF serial % (3 or 5) == 0 THEN access=2;}
initial trial access will be 1 and when trial ends can set access to 0
done
|