Mildly Cryptographic

Posted on 1998-12-20
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
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
LVL 16

Accepted Solution

imladris earned 100 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 84

Expert Comment

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

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

626 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