Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a license key algorithm [closed]

There are a lot of questions relating to license keys asked on Stack Overflow. But they don't answer this question.

Can anyone provide a simple license key algorithm that is technology independent and doesn't required a diploma in mathematics to understand?

The license key algorithm is similar to public key encryption. I just need something simple that can be implemented in any platform .NET/Java and uses simple data like characters.

Answers written as Pseudo code are perfect.

So if a person presents a string, a complementary string can be generated that is the authorisation code. Below is a common scenario that it would be used for.

  1. Customer downloads software which generates a unique key upon initial startup/installation.
  2. Software runs during trial period.
  3. At end of trial period an authorisation key is required.
  4. Customer goes to designated web-site, enters their code and get authorisation code to enable software, after paying :)

Don't be afraid to describe your answer as though you're talking to a 5yr old as I am not a mathematician.

like image 453
angryITguy Avatar asked Apr 15 '10 01:04

angryITguy


People also ask

How are license keys generated?

License keys are typically created and delivered via a license generator once a software user has paid for the software and has agreed to the terms and conditions set out in the End-User License Agreement.

What is a license key on a phone?

A license key gives an authorized user/purchaser a data string that, upon installation, unlocks a software product and makes it available for use. Without the key, the software cannot be used. This prevents users from loading copies of the software to different devices.

How do I generate and validate a software license key in VB net?

To generate a code, simply set the SerialNo , ProductID , and OptValue properties, and read the result with the KeyCode property: Optionally, you can set the Salt property to make your keys more unique than the default.

What is license key management?

Through the issued License Key, LicenseKey Manager allows you to have full control over the distributed software. With the provided limits and options, you can easily license your software in many different ways.


2 Answers

There is no reliable licensing algorithm. Really. Not even one. For the most popular, most expensive proprietary software you can buy, you can also find "key generators" and hacked versions that don't require licensing.

Instead of worrying about making it "unbreakable", just do something simple. A popular mechanism is to, at purchase, ask for the user's name, and then give him a license key that's derived from a cryptographic hash (e.g. MD5 sum) of the user's name, or some variation on it. Then, in the software you ask for their name again, plus the registration key (that MD5-derived thing); you check to see that they match, which activates the software.

Can this be hacked? Absolutely. Once someone figures out how you're generating the license keys, they can generate their own. But if you keep a database of the "official" license keys you've generated so far, at least you'll be able to identify the fraudsters later on (perhaps when they try to download "premium" content or something).

But don't worry so much about stopping the hackers from cracking your code. It's going to happen, but they're such a tiny part of the market that it won't significantly affect your overall sales.

like image 145
tylerl Avatar answered Oct 06 '22 12:10

tylerl


I use a system like this:

• create a string from windows licence key + trial period end date

• generate a hash (Sha/md5) from the string

• convert the trial end date to an int (e.g. Number of days)

• the key becomes trial end date + some part of the hash

• convert the key to only uppercase characters to make it easier to enter

ABCD-DEFG-HIJK...

the validation works like

• convert key to bytes again

• extract trial end date

• create string from windows licence key + trial end date

• hash

• compare hash with rest of key

this makes it difficult enough for my audience.

like image 23
adrianm Avatar answered Oct 06 '22 11:10

adrianm