Page 1 of 1

encoding for licensing the software

Posted: Wed Dec 14, 2016 3:35 am
by ampandya
HI
I have a software which i want to licence to the users.

I have Name, Exp. date and the hardware mac code.

I want to give them the Code to enter which is encoded using these 3 objects.

Could someone please help me for this?

Thank you

Re: encoding for licensing the software

Posted: Wed Dec 21, 2016 1:25 pm
by bborzic
ampandya wrote:HI
I have a software which i want to licence to the users.
I have Name, Exp. date and the hardware mac code.
I want to give them the Code to enter which is encoded using these 3 objects.
If you have the Xb2.NET library ( see: http://xb2.net/xb2net/ ), then you can use the xbHash function to create a unique hash of the values you specified. Example:

cHash := xbHash( SHA256, cName + dtos(dExpDate) + cHardwareMac )

A hash or message digest is a fixed-size bit string, such that any change to the message will (with very high probability) change the hash value. You can further encrypt the hash value using a secret password, although this step is probably not needed. Example:

cKey := xbRC4SetKey("some secret code")
cEncryptedHash := xbRC4( cKey, cHash )


Since the output from the above functions is a binary string, we can make it more user friendly by converting to base64, eg:

cLicenseKey := xbBase64Encode(cEncryptedHash)

You give the user the above lincense key which they can enter into your program. Your program then verifies it by performing the above calculations internally. If the results match, then the license key is valid.

Re: encoding for licensing the software

Posted: Fri Dec 23, 2016 5:11 am
by ampandya
Many Thanks,

I will try this.