We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

# Registration key

on
Medium Priority
279 Views
I am trying to find algorytms to create a Registration
Key system but am having trouble locating this.
Any ideas would be gretly appreciated even the simple ones.
Comment
Watch Question

## View Solution Only

Senior Technology Consultant
CERTIFIED EXPERT

Commented:
Don't exactly know what you are looking for,
a search algorithm like binary search,
or keys for dividing data in divided parts,
e.g. the alphabet, if so, what are you trying
to register? and what are the desired function?
(like equally divided..etc)
Commented:
A registration algorithm is pretty easy. Here's a good one (it's a sample):

Generate a random four digit number:
randum := random(10000);
then make it into a string:
str(randnum,randstring);

those first four digits are the first part of the registration key
regstring = randstring;

the remaining digits will be calculated by doing stuff to the digits of that number.
for example, try this

regstring  = regstring + chr(randnum div 30);
regstring  = regstring + chr(randnum div 27);
regstring  = regstring + chr(randnum mod 19);

do this until you have enough digits (I do it like six times)

To check the validity of the registration code in your program, you can do this:

you know the random number, because it's the first four digits of the registration string the user enters in. val it and move it to a variable rannum. Then, check

if (regstring[5] != chr(randnum/30)) then
it's not registered, so set a variable or something
... do this for each digit.

See. It's pretty cool. If you have any more questions, or want to base the registration number on the name of the customer or something like that, feel free to e-mail me at mrosen@peganet.com.

Not the solution you were looking for? Getting a personalized solution is easy.

##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile