In my previous article, I showed a simple algorithm which describes how to build a trial version for main application. Now we make a combination of keys. So we can distribute our products to several customers.
Now we build several product keys using a 2D array. The array elements are random but they are not a random number generated by application. When we save a product key in the Registry we make a simple trick & over write the product key string with a type conversion. So if the user can find the registry key then he can't access the right product key.
For the combination we build a 5x10 array, like:
string[,] passwordSt = new string[,] // 5X10
{
{"ASDF","QWER","MKOG","EDFR","CVBH","DRFW","HNKO","GHER","RERW","SWVU"},
{"ASDW","HJUM","VGTR","VFDS","PCFT","GEIK","CWTH","GETD","ETDA","EFQS"},
{"HGFD","POLK","DFRE","NBGH","JYUO","GECS","DFWU","GQAS","VRYE","CAER"},
{"GFHY", "OPHY","GHSW","JNYH","CFFR","VS5H","CD3T","C67N","F34F","F8J5"},
{"DRFW", "HNKO","GHER","RERW","SWVU","E4N7","2C8U","3F5N","3CFD","F5UT"}
};
For these five rows we can build 10 different keys. All total we can build 1,000,000 keys.
In Main in the application the Program.Cs file looks like:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
String abc = @"Software\Tanmay\Protection";
string[,] passwordSt = new string[,] // 5X10
{
{"ASDF","QWER","MKOG","EDFR","CVBH","DRFW","HNKO","GHER","RERW","SWVU"},
{"ASDW","HJUM","VGTR","VFDS","PCFT","GEIK","CWTH","GETD","ETDA","EFQS"},
{"HGFD","POLK","DFRE","NBGH","JYUO","GECS","DFWU","GQAS","VRYE","CAER"},
{"GFHY", "OPHY","GHSW","JNYH","CFFR","VS5H","CD3T","C67N","F34F","F8J5"},
{"DRFW", "HNKO","GHER","RERW","SWVU","E4N7","2C8U","3F5N","3CFD","F5UT"}
};
Secure sec = new Secure();
bool logic = sec.Algorithm(passwordSt, abc);
if(logic ==true)
Application.Run(new Form1());
}
Anybody can easily make a dll which only contains a Product Key. (I am not writing on that right now)
I pass it through main.
Now user should provide a 20 Character Product key. (a combination of those).
The screen looks like:

What is the Combination?
I upload here a KeyGen which builds a 20 character Product Key.
It looks like:

In the first box you provide a 5 digit Integer string & it build a key using the given 2D array.
Example: 51541
passwordSt[0,5]= DRFW
passwordSt[1,1]= HJUM
passwordSt[2,5]= GECS
passwordSt[3,4]= CFFR
passwordSt[4,1]= HNKO
So, you can provide from 00000 to 99999 Product key.
As we rewrite our product key with a conversion. The Conversion processes are very simple. We convert corresponding Character to equivalent Integer so we get a long integer string (number) that will be saved in the registry. But if the user fins it, he/she could not get the original Product Key.
So if any tool can retrieve any thing it can't get the original Product Key.
You can distribute the same copy of your product to 1,000,000 people. We can also use a dll to write our Product Key Combination String.
That's it!
File: I upload here
- A sample Main app
- Trial Maker Dll
- KeyGen (Only for this String) Don't Distribute Keygen it's only for generate password, and distribute your application with a single key. Keep the 5 digit number to identify your customer. Like for 00000 you get a product key, 00001 get another one and so.
Few Words:
All the applications are built with VS 2010 in 3.5 Framework.
Hope it will help you!
Thank You!

Gajanan SontakkePosted May 28, 2018, 12:38 AM
How to set no of days
faizan ahmadPosted Apr 22, 2015, 2:21 AM
In the above code i want to know ...what is string abc = @"Software\Tanmay\Protection"; kindly help me
Anup PalPosted Feb 4, 2014, 3:03 AM
Thanks,only thanks will not work here but,what can i say it helped me a lot,i would like to talk to you if you provide me with your email ID
Archit PatelPosted Aug 26, 2013, 6:41 AM
good one
ketan italiyaPosted Aug 22, 2013, 1:59 AM
great work..thankss
Rodrigo DuartePosted Jul 19, 2013, 10:15 PM
Guy Thanks for the great help, Your code was very much appreciated by friends programadosres here in Brazil. Thanks! and success!
CelsoPosted Jun 7, 2013, 9:26 AM
In that way, you will have 15 days for each PC... This is not a big problem :) Just a suggestion for a possible improvement. If I get something new I will share here with you.
CelsoPosted Jun 7, 2013, 8:39 AM
Great article! Congrats! Only a tip: It won't work for a small intranet network. I mean, if you install your app to the main PC and grab a shortcut to other PC it won't work anymore. The main PC won't open the app but the other PC will do.
Nilanjan RoyPosted Jan 18, 2013, 11:39 AM
how can i check for years? i want this program to identify for how many years is a single pool of array? i have to define 2 pools of string[] and i want it to check from which pool its given.. any help will be appreciated.
Paul May IIIPosted Dec 16, 2012, 10:45 AM
Mr Sarkar, This code was very good; I am a novice looking for code similar to this. If you don’t mind my suggestion, if you incorporate nic card Mac address to this code, as this is unique. The end user would not be able to pass along the key to their friends etc. Here is a post I found in visual basic, I've tried to rewrite in c# with little success, it may be of help. http://www.codeproject.com/Articles/28550/Protecting-Your-Software-Using-Simple-Serial-Numbe
harun rashidPosted Dec 13, 2012, 1:35 AM
In your proposed method with the same key we can run the application in different computers. I want that --- one key is just for one PC's.
bevalti bevaltiPosted Dec 30, 2011, 5:37 AM
hi !! thank you for this nice post I want to know how can I test if the product was activated or not in my main Form (or MainWindow in WPF), and I will change my Label text from "unactivated version" to "this is an activated version"!! Thank you
karthik rajaPosted Apr 21, 2011, 7:15 AM
Thank u ... Its very useful to me...
Theo DibbetseditedPosted Oct 31, 2010, 11:58 AMEdited Oct 31, 2010, 12:06 PM
Great concept
ehsan khakifiroozPosted Oct 28, 2010, 3:53 PM
I've cracked many programs which used Online Activation. I suggest you: 1-use Unmanaged programs for Lock library and It's accessors. 2-use hashing or encryption methods that are performed by microsoft library. 3-use any post-development recompilation system even that you performed can be better! 4-at the end everytime try to crack your program. It can give you more strength.
Hoang ThucPosted Oct 28, 2010, 12:00 PM
Firstly, thanks for your article and your reply. My product runs offline and I'm afraid that my customers have no internet connection. I concern about the algorithm of Microsoft when activating their offline product, as Office, Visual Studio,.... I've studied about MAC address, but until now, it's still confuse. Wait for your new article about this issue...
Hoang ThucPosted Oct 28, 2010, 8:32 AM
I see that the customers can buy a key and setup your program for all computers they want, even they can public that key for their friends. How do you solve this problem?
ehsan khakifiroozPosted Sep 10, 2010, 12:03 PM
It's so easy to discover keys from Assembly via Deassemblers. So, what's your solution?