Solved

How do program installation keys work?

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

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 111
URL for downloading Google Chrome for Win XP 2 279
Working with hours 3 87
shape, triangle, dbctrlgrid 3 46
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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