Solved

Serial number validation code

Posted on 1997-08-21
3
688 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.
0
Comment
Question by:alexxx
3 Comments
 
LVL 2

Expert Comment

by:tovergaard
ID: 1253479
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.
0
 
LVL 2

Author Comment

by:alexxx
ID: 1253480
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.
0
 
LVL 3

Accepted Solution

by:
msmits earned 200 total points
ID: 1253481
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

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now