Go Premium for a chance to win a PS4. Enter to Win


Mildly Cryptographic

Posted on 1998-12-20
Medium Priority
Last Modified: 2010-04-15
I wish to generate registration codes for users of software.

The users software has an embedded unique INT known by me
int user = 12345678;

Now I have a fixed key INT known only to me
int key = 19673215;

How would I write an algorithm to generate ascii passwords for the users to enter, (when emailed to them).

And an algorithm within the program to check that the supplied password is valid for the unique user ID int.

This not on UNIX so crypt is not an option and I want to do something a bit more exotic than XOR.

Can anybody help??????
Some workable C code examples only please

Question by:samas122098
LVL 16

Accepted Solution

imladris earned 400 total points
ID: 1255346
The simplest way to proceed would be along the following lines:

Write any old algorithm that transforms the number in their program in some hideous fashion. Do exponentiation, multiply it by big constants, add big numbers, subtract them, take sines and add the result etc. etc. Whatever makes you feel nice and secure. Now the idea is for this to be a one-way (trapdoor) algorithm. I.e. it is reasonably apparent (at least to you) how to get the result given the initial number and the algorithm. However it tantamount to impossible to get the first number from the second one, even if you have the algorithm.

Now, the user phones up and wants to register his package. You get the number embedded in his software. You generate the second number for him. Now he can enter that as a number or you can try to pretty it up by getting letters for it. For instance if the second number is 1234132, you can have him enter 1234132 or you could make ABCDACB or something along those lines.

Now the user enters that and the program stores it somewhere. Whenever the user goes to execute his program it takes the number in it, turns the hideous algorithm loose on it and compares the result to what the user entered. If it matches; voila he is registered and enabled.

LVL 85

Expert Comment

ID: 1255347
Is the user ID int chosen by the algorithm?

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

885 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