[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do program installation keys work?

Posted on 2003-12-04
1
Medium Priority
?
191 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
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 this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 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