Solved

How do program installation keys work?

Posted on 2003-12-04
1
185 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 250 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
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.…

690 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