We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Serial number validation code

alexxx
alexxx asked
on
Medium Priority
781 Views
Last Modified: 2010-08-05
Can anyone send me working C code for some advanced serial number checking algorithm. I want certain number of serial numbers to be reserved in advance, it is not necessary to extract the user's name from it though. Thanks in advance.
Comment
Watch Question

One common method to checking serial numbers is to use a hash algorithm. A hash algorithm is a one-way function, this means you calculate a sort of checksum, but it is not possible to calculate the serialnumber if the hash value is known.

I am sure you will the sourcecode to a hash algorithm can be found at the Internet.

Author

Commented:
Thank you tovergaard. I'm sorry for not accepting your answer. If I use some sort of hash function (& check the calculated value against some unique predefined value) then how do I guarantee that I can find at least N valid serial numbers? What's more, to use this technique I need an algorithm to generate valid serial numbers with acceptable growth rate - straightforward iteration over all values and checking their hash value just won't do. I beleive the solution to this is to use some encryption technique based on prime numbers or something of the kind. Unfortunatly I have no time to get into all this theory, what I want is the C code which does this job more or less with a bit of explanation to get me started. Thank you.
Commented:
What you can do is give out a serial number and key value.
Inside you program you encode the serial number with some secret code (can be simple like concatenation of both or alternating bytes of both) and then running this through the md5 algorithm.
The result of this should then be equal to the key value you gave out with the serial number.
You have a special program for yourself that does the same to generate the keys for the serial numbers you invent.

Source code for the md5 algorithm can be found with the RFC that describes it. Look at altavista for 'md5 +source' and the third item is:

  http:/wsspinfo.cern.ch/sec/tools/md5

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

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

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

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.