Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When I originally wrote this answer it was under an assumption that the question was regarding 'offline' validation of licence keys. Most of the other answers address online verification, which is significantly easier to handle (most of the logic can be done server side).</p> <p>With offline verification the most difficult thing is ensuring that you can generate a huge number of unique licence keys, and still maintain a strong algorithm that isnt easily compromised (such as a simple check digit)</p> <p>I'm not very well versed in mathematics, but it struck me that one way to do this is to use a <a href="http://en.wikipedia.org/wiki/Graph_of_a_function" rel="noreferrer">mathematical function</a> that plots a graph</p> <p>The plotted line can have (if you use a fine enough frequency) thousands of unique points, so you can generate keys by picking random points on that graph and encoding the values in some way</p> <p><img src="https://i.stack.imgur.com/t6SeY.png" alt="enter image description here"></p> <p>As an example, we'll plot this graph, pick four points and encode into a string as "0,-500;100,-300;200,-100;100,600"</p> <p>We'll encrypt the string with a known and fixed key (horribly weak, but it serves a purpose), then convert the resulting bytes through <a href="http://en.wikipedia.org/wiki/Base32" rel="noreferrer">Base32</a> to generate the final key</p> <p>The application can then reverse this process (base32 to real number, decrypt, decode the points) and then check each of those points is on our secret graph.</p> <p>Its a fairly small amount of code which would allow for a huge number of unique and valid keys to be generated</p> <p>It is however very much security by obscurity. Anyone taking the time to disassemble the code would be able to find the graphing function and encryption keys, then mock up a key generator, but its probably quite useful for slowing down casual piracy.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload