• C

# Mildly Cryptographic

I wish to generate registration codes for users of software.

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

Now I have a fixed key INT known only to me
say:
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

###### Who is Participating?

Commented:
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.

0

Commented:
Is the user ID int chosen by the algorithm?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.