Generating 30 000 unique keys in a matter of seconds.

License Key Generator

A human-friendly generator for license keys and serial numbers.

Features

  • Full multithreading, thanks to .NET Core’s TPL (Task Parallel Library);
  • Custom “resulting-sum” algorithm to generate a bunch of unique license keys quickly;
  • Responsive UI, built in WinForms (glamorous, indeed);
  • On-the-fly license key validator;
  • Decoupling, e.g. strict separation between UI and logic;
  • Generated license keys that are easy for people to spell out loud;
  • Native support for async/await.

NuGet packages, demo, source

Get the generator NuGet package from https://www.nuget.org/packages/BarbezDotEu.License.Generation/ or use

Install-Package BarbezDotEu.License.Generation -Version 1.2.0

Get the verifier NuGet package from https://www.nuget.org/packages/BarbezDotEu.License.Verification/ or use

Install-Package BarbezDotEu.License.Verification -Version 1.2.0

Source code on GitHub: hannesbarbez/BarbezDotEu.License: License key generation and verification (github.com)

Demo application for inspiration: hannesbarbez/BarbezDotEu.License.Generator.WinForms: Barbez.Eu Serial Number Generator (github.com)

Custom “resulting-sum” algorithm

Lacking academic knowledge on serial number or license key generation algos, the generator algorithm is my own idea, so I’ve decided to dub it “resulting-sum”. More info on the exact workings to follow, for now the source code should suffice to explain its inner workings.

Performance

Note: these stats are from the initial version of the NuGet package. Newer versions of the package are quicker, yet the overal trend of the graphs remains.

After running a couple of tests on an AMD Ryzen 1600 (6 cores, 12 threads) based machine, I compiled a short table with the results.

On this hardware, a ResultingSum of 68 takes Y time to render/generate X number of unique keys. The sweet-spots are marked in bold in the below table.

Results will differ for other ResultingSum values. For a value of 68, 30 000 unique keys are generated in under 9 seconds.

The going gets tougher when generating 150 000 unique keys in exactly 4 minutes. Oh lawd.

Table

Keys (X)Time (ms, Y)ms/key (=Y/X)
11212.00
10131.30
100320.32
10001460.15
25003580.14
50007190.14
1000015000.15
2000048000.24
3000086000.29
50000213000.43
62500315000.50
75000438000.58
87500660000.75
100000840000.84
1500002400001.60
A ResultingSum of 68 takes Y time to render/generate X number of unique keys on a Ryzen 1600 based machine.

Graphs

Note: these stats are from the initial version of the NuGet package. Newer versions of the package are quicker, yet the overal trend of the graphs remains.

Y time needed (ms) to generate X number of keys.
Y time needed (ms) to generate X number of keys.
Y time needed (ms) per key when generating X number of keys.
Y time needed (ms) per key when generating X number of keys.

Screenshots of app demoing the NuGet packages

Eye candy?

Maybe not so much. After all, it’s WinForms in 2020.

The Barbez.eu License Key Generator as it appears when launched.
The Barbez.eu License Key Generator as it appears when launched.
The Barbez.eu License Key Generator is thinking hard.
The Barbez.eu License Key Generator is thinking hard.
The full-screened Barbez.eu License Key Generator, having generated 30 000 unique keys in a matter of seconds.
Generating 30 000 unique keys in a matter of seconds.
On-the-fly testing of one of the generated license keys.
On-the-fly testing of one of the generated license keys.
Better luck next time.
Better luck next time.

Versions

1.2.0 (January 18, 2021)
– Fix: No more false keys generated in corner-cases.

1.1.0 (January 18, 2021)
– Fix: Extending permissible resultingSum values;
– Fix: No longer skips loop item on duplicate first attempt;
– Improved: Documentation.

1.0.0 (January 14, 2021)
Initial version.

In conclusion

The Barbez.eu license key generator is ideal if you’re in need of a decent number of license keys or serial numbers that are easy and quick to spell out to one another, and quick enough to generate.

Mild disclaimer

The code in this repository was written for and used within a variety of Barbez.eu apps distributed via Amazon.com in the late 2010’s.

If you’re looking for a license key generator that is “uncrackable”, this is one is not for you. You can however consider using it as a base for your own license key generator, perhaps.