Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Mildly Cryptographic

Posted on 1998-12-20
Medium Priority
228 Views
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

0
Question by:samas122098
[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

LVL 16

Accepted Solution

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.

0

LVL 84

Expert Comment

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

## Featured Post

Question has a verified solution.

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
###### Suggested Courses
Course of the Month4 days, 14 hours left to enroll