Generate serial numbers for each product key and v

2019-09-03 16:33发布

问题:

I have a piece of software with different unlockable modules. Each module has to be purchased separately. I've started with assigning a unique key to each module via Guid.NewGuid method.

Now I have to provide users with serial numbers for activating those upgrades, and then the numbers will need to be validated:

  1. Serial number belongs to specific product key
  2. Serial number is valid for specific product key.

Any suggestions how to generate a serial number based on the Guid product key and perform a reverse operation for validation?

Thanks.

回答1:

Perhaps you can generate some sort of hash based on the user's name and company. Then take that hash and generate some sort of combined hash based on the first hash and the product's GUID. Use that final hash to form your key.

Then your program does the same thing (the user must enter their name and company) and if it comes up with the same final hash value, consider it to be valid.