I don't have the algorithm. I need a random one created that follows some formula, so as to authenticate any user that might need to unlock the software.
Thanks!
Main Topics
Browse All TopicsI currently need a program that generates a 20 digit code based on a given algorithm. The program will be used to generate codes for use in a software application. Our programmer should be able to use the code to both generate codes for new users, and to verify a user has the proper numerical code.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
What you are asking for is quite a task ... One relatively simple way of doing it will be ...
Take some constant information like cutomer name, product version etc. and form a string. Calculate MD5 hash of this string.
MD5 + Serial = constant number
This is fast and easily reversible but is not too secure either.
Yet another way will be to define fields in your serial, say first 4 digits will be a number divisible by 13 next 4 digits will be a prime number and so on so forth ... you can then convert them to base 36 or any other number of characters ...
As you can see, the security in either case depends on how well you can keep a secret.
seeding is fine ... Assume that a copy of your program is with a customer who enters a serial number. Now your program needs to decide if the serial number is correct or not. So you will have to seed the random number generator and regenerate the same sequence of random numbers but
- uptil what point? It might be a thousand or million iterations before you get the serial.
- how do you ensure that it does not accept any other random number as serial? A random number generator is expected to generate every value after sufficient iterations
- How do you make sure that it does not generate same key twice - you need unique random numbers and not just random numbers
There might be more but that was all I could think of at the moment.
mj9821,
Is it OK to impose a restriction that you need internet connection to register?
If yes, then we can have far more reliable method as
Take some constant information like customer name, product version etc. and form a string. Calculate MD5 hash of this string. Append current time to this string.
MD5_time + Serial = constant number
Or even
MD5_time
While registering the time component will be the time at which the serial was generated by you (time of purchase) and give customer name etc, you should be able to retrieve time from your database to verify the serial.
You can do some reversible bitwise operations on final string to make it more secure.
Cheers!
sunnycoder
Here's an algorithm:
Generation: Get the time of day, that's your starting variable D
Now repeat 20 times: print D mod 10; D = (D * 4999) mod 1000000;
That will give you a string of 20 digits.
For testing this string, just run the same code with D = the first digit.
Note:
If you look at the cracks web sites you will see that these methods are easily broken by crackers-- one site boasts 14,000+ cracks. Most every validation routine eventually ends up at a conditional jump instruction-- all the cracker has to do is find that instruction and put a 90h (NOP) over it and the app is cracked.
>Most every validation routine eventually ends up at a conditional jump instruction-- all the cracker has to do is find that
>instruction and put a 90h (NOP) over it and the app is cracked.
But note that serial number generators are looked more highly upon than file modifications.
Anyhow, anything except crippleware can be cracked. And with crippleware, it's just time before some registered user put the full version on one of the p2p networks.
Business Accounts
Answer for Membership
by: koposPosted on 2005-01-24 at 20:32:26ID: 13128523
>> I currently need a program that generates a 20 digit code based on a given algorithm
do you have the algorithm?