Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Licence Key

Status
Not open for further replies.

TinLegs

Programmer
Jan 14, 2003
100
NZ
I would like to generate a Licence Key which is to based on the charactors of the Licencee name (normally the name of a club). The Licence Key will be used to upgrade a trial version of the program to a full non-restricted version. Rather than trying to re-invent the wheel so to speak I wondered if any of you have any code snipplets from which I could base my Licence Key generator. It is for an older Legacy program compiled with Clarion 6.1 but an ABC code sample would be fine - Thank you.
 
Hi!

There is no set algorithm for this but it is easy to make your own using the VAL() function i.e. use the VAL() function on all the characters of the License Name, License Type and License Start Date, License End Date and add/subtract/multiply/divide those results to arrive at the License Key which you can verify. If you want superior protection, you need to look at 3rd party products like SecWin from Capesoft, etc. You can also look at for some free utilities to create WEP keys and encryption methods which will help you arrive at a key.

Regards
 
The question becomes, what are you using the Licence Key for?

Assuming it's for some form of branding / copy protection. I suggest that you take a peek at Armadillo. It's a packer/encryptor with many built in features for controlling access to the entire program or even modules.

I noticed in the NGs that Charles Edmounds recently released his product, to wrap the Armadillo work and really tighten up the obfuscation.

HTH,
Mark
 
Thanks Guys, I appreciate the feedback.
I have taken the simple approach and it seems to work fine so just in case its of any help to anyone this is what I have done. Firstly I have an encryted file which is read by the program at startup which defines if its a demo or not.
To create a licence key:
Get length of 'Licencee Name' ie. LEN(LicName)
Step through LicName ie LOOP (LEN) TIMES using SUB(LicName,1,x)
Get the value of each charactor-VAL(Char)-and add them up.
Multiply and add other charactors if wished to get a fixed string length and to mix it up a bit.

Since the Licence file is protected and can not be written to I REMOVE it and CREATE a new one if the user enters the correct Licence Name and matching Licence Key.
 
Hi!

Not sure of you code, but you don't need to SUB() to do a VAL() i.e. you can use string slicing ::

Code:
LicenseKey = 0
LOOP C# = 1 TO LEN(CLIP(LicName))
   LicenseKey += (VAL(LicName[C#] * C# * <MySplNumber>)
END

Multiplying by the position of the character makes sure that interchanging 2 chars in the License Name makes it invalid.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top