How to generate CD Keys

Posted on 2010-11-08
Last Modified: 2012-05-10
Where can I find an algorithm to generate and include CD Keys in my applications?

In C# or C++

CD Keys like Microsoft uses for it's applications (ex. XX35-KJ32-PLKF-K43J)
Question by:evo_x
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 16

Expert Comment

ID: 34090490
Take a look at this:

This will give you an insight how you can generate your keys.
LVL 44

Expert Comment

ID: 34091040
I don't know if there is a 'standard'.  In fact if one thinks about it then a standard way could be abused.

You will need code to create a key AND code to check the key the user enters is valid.

I suggest you need to think about what information you require in the key.  What format the key has.  What sort of extra padding you want in the key to give a constant length.  Possibly one or two chars for a checksum type of validation.  Finally an encryption routine to then hide things.

I've done things like having an expiry date as 5 digits, the 1st in char 4, 2nd in char 11....

Author Comment

ID: 34091892
I need to include the product id, version number and reseller id
any method would be good as an example.
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.


Author Comment

ID: 34091905
AndyAinscow: That is what I am looking for but that is a commercial library, I want to implement my own instead of paying $250
LVL 44

Expert Comment

ID: 34091962
What I did was sit down with a piece of paper and list what I required.  Worked out how many digits I needed, then jumbled the digits around.  A couple of hours and everything was coded.

Author Comment

ID: 34093003
And what encryption method should I use? which is free of course for commercial use.
LVL 44

Accepted Solution

AndyAinscow earned 500 total points
ID: 34093496
Whatever you wish.

This is one possibility:


Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
locate sql commands in C# visual studio Project 6 45
parsing question on dynamic concatenation 3 34
Visual Studio 2015 auto inserted code 12 72
Adjust the codes 3 37
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question