Rate this post

For the old-school CD keys, it was just a matter of creating an algorithm for which the CD keys (which could be any string) are easy to generate and easy to verify, but the proportion of valid CD keys to Invalid CDs -keys is so small that it is unlikely that randomly guessing the keys of a CD will give you a valid one.

INCORRECT WAY TO DO IT:

Star boat Y Half life both used the same check sum, where the 13th digit verified the first 12. Therefore, you could enter anything for the first 12 digits and guess the 13th (there are only 10 possibilities), which leads to the infamous 1234-56789-1234

The algorithm to verify is public, and it looks something like this:

x = 3;
for (int i = 0; i <12; i ++)
{
x + = (2 * x) ^ digit (i);
}
lastDigit = x% 10;

Right way to do it

Windows Xp It takes a lot of information, the number and places the coding of the letter / number on a label. This allowed MS to verify its key. Y Obtain the type of product (House, Professional, etc.) at the same time. In addition, it requires online activation.
The complete algorithm is quite complex, but it is described very well in this document (completely legal!), Published in Germany.

Of course, it does not matter what you do, unless you are offering an online service (such as World of Warcraft), any kind of copy protection is just a stalemate: unfortunately, if it's a worthwhile game, someone will break (or at least elude) the CD key algorithm and all other copyright protections.

REAL Right way to do it:

For online services, life is a bit simpler, since even with the binary file, you must authenticate with your servers to make any use (for example, having a WoW account). The CD key algorithm for World of Warcraft, used, for example, when buying playtime cards, probably looks like this:

  1. It generates a cryptographically very large secure random number.
  2. Save it in our database and print it on the card.

    Then, when someone enters a game time card number, check if it is in the database, and if it is, associate that number with the current user so that it can never be used again.

For online services, there's no reason do not use the previous scheme; Using anything else can lead to problems.