?
Solved

How do program installation keys work?

Posted on 2003-12-04
1
Medium Priority
?
188 Views
Last Modified: 2010-04-05
Hi,

Can someone give me an explanation (or point me to a useful link) as to how  program installation keys work?
This is my difficulty:
Assuming the keys (each software package has a different key) all decrypt to one value, how is it possible that numerous values decrypt to one value?

(I have a basic knowledge of rsa, hashes etc but try to keep it simple :) )

Conversely, how are the different key generated?

Thanks,
Joe
0
Comment
Question by:SafariJoe
[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
1 Comment
 
LVL 8

Accepted Solution

by:
gmayo earned 750 total points
ID: 9881495
You mean the code you usually have to enter whilst installing software? They rarely degenerate down to a single value. Rather, a *set* of values are allowed. One Microsoft one from a few years ago had the format something like XXX-XXXXXX. As long as you entered a set of digits that added up to a multiple of 9 you were okay - which meant that 111-111111 worked! Since then, they've got a little more complex and MS are obviously not going to tell you how to calculate that value.

I used a key once for my own software which was also pretty simple. Anybody with an hour to spare could probably have cracked it. All it was was the program name letters added up (their ASCII values), a couple of magic number additions later and then you have a key! The source follows:

To generate a key (different each time):

program SimSigRegister;

uses
      Dialogs, SysUtils;

var
      sim, reg : string;
      i, key, total, count : integer;
      found : boolean;
begin
      Randomize;
      if InputQuery('Create registration number', 'Enter simulation ID (data directory name)', sim) = true then begin
            sim := UpperCase(sim);
            key := 0;
            for i := 1 to Length(sim) do begin
                  key := key + Ord(sim[i]);
            end;
            key := key mod 1000;
            total := (key * (500 + Random(500)));
            reg := Format('%x (key %d)', [total, key]);
            ShowMessage('Registration code is ' + reg);
      end;
end.

To validate a key:
function ValidateRegistration(s : string) : boolean;
var
      sim : string;
      code, i, key : integer;
      vi : integer;
      vr : single;
begin
      if s = '' then begin
            Result := false;
      end else begin
            sim := UpperCase(MiscData.SimData.SimulationID);
            key := 0;
            for i := 1 to Length(sim) do begin
                  key := key + Ord(sim[i]);
            end;
            key := key mod 1000;
            try
                  code := StrToInt('$' + s);
                  vi := code div key;
                  vr := code / key;
                  Result := (vi = vr) and (code > 999);
            except
                  Result := false;
            end;
      end;
end;


Geoff M.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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