Solved

How do program installation keys work?

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now