Serial Number Generate

I wondering about how serial number generators and validator work. My aim would be to generate a serial number with five parts consisting of numbers and letters only.

If your company needs unique IDs or serial numbers for the products you sell on your forms, then this is the template for you. This form auto-generates numbers or serials when the form loads. This is useful for products or services that require unique ID for tracking. Most product key finder programs are designed to find serial numbers and product keys for operating systems, like Windows 10 or Windows 8, but some of them find serial numbers for several other programs as well—programs like Adobe Acrobat.

I enjoy coding as a hobby and would not call myself a professional programmer. However, I am very interested in how those interesting functions work technically to broaden my mind.

Any hints, experiences or written algorithms are appreciated.

dsolimano
7,5673 gold badges39 silver badges56 bronze badges
SimonSimon
8482 gold badges13 silver badges22 bronze badges

closed as not constructive by Tim PostNov 30 '12 at 1:39

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

7 Answers

Brandon Staggs wrote a good article on Implementing a Partial Serial Number Verification System. The examples are written in Delphi, but could be converted to other languages.

stukellystukelly
3,7542 gold badges30 silver badges41 bronze badges

Get yourself a public/private key pair. Generate sequence numbers (10000, 20000, 30000, 40000, ....) that have some identifying characteristic (e.g divisible by 10000). Encrypt that number using your private key. Encode that value using some human readable system (base 32 or 64) and separate the values into groups to make it easier for people to parse. Distribute the encoded serial number with each sale of you app.

Somewhere in the app, you have the public key hidden away. When a user enters an encoded serial number, first decode it back to binary. Use the public key to decrypt it. Check that it is divisible by 10000.

The hard part is in the implementation - hiding the public key in the app so that it can't be replaced easily. Choosing some sequence that you can identify easily, but not run out of values. Obfuscating the app so that someone can't easily skip past the whole check. etc...

EclipseEclipse
39k16 gold badges101 silver badges162 bronze badges

Well, traditionally serial numbers are serial ... numbers. So the first example off the production line has sn 0001 then the next one is 0002 and the next one is 0003. I think that most people can work out that algorithm.

I think you're actually asking about product keys, which use a similar mechanism to public key message signing - the product key is the encrypted value, the program has a public key which allows it to verify that the key is valid, but only the software vendor has the secret key to 'sign' the product key. The wikipedia article on digital signatures has the general mechanism; the only proviso is that for a key to be entered by the user it has to be quite a bit shorter than a PGP one.

If you are restricted to a very short serial number, then it's unlikely to be big enough to store the result of a typical signing mechanism, in which case it's quite common to just use some variant of checksum on it. That has the disadvantage of being easy to reverse engineer - it's security is because the algorithm is 'secret' rather than due to any cryptographic properties. Each product would have its own algorithm, and they usually get cracked quite quickly.

If you have 5 blocks of 5 characters, you have 36^25 combinations, which is bigger than 2^128, so could use one of the standard digital signature algorithms which generates a 128 bit, then convert that value to base 36.

Pete KirkhamPete Kirkham
43.6k4 gold badges80 silver badges153 bronze badges

A GUID ('Globally Unique Identifier') could be an easy way to solve this:

Guids contain 16 bytes and are most commonly written in text as a sequence of hexadecimal digits such as:

And most programming languages should be able to generate a GUID with one of the available libraries.

mjnmjn
26.4k23 gold badges145 silver badges321 bronze badges

You can use a random number generator and store the outputs in a database.In case of activation request, you just check if the serial is in the database and mark the serial as 'used'.

Of course, this needs an internet connection, but is good against 'buy once, use many,many times' method and in case of support-call, you can reactivate that serial for another reinstall.

Later edit: You also must use for the internet verification an encrypted and authenticated connection, like a HTTPS one.

adriansadrians

Using my Google-Foo, I came up with this article:

Gavin MillerGavin Miller
34.6k18 gold badges106 silver badges170 bronze badges

Lots of info here:

ʞɔıuʞɔıu
30.3k27 gold badges84 silver badges128 bronze badges

Not the answer you're looking for? Browse other questions tagged algorithmgeneratorvalidationserial-number or ask your own question.

How can I program a Serial Number Generator that generates serial numbers for some existing software?

dsolimano
7,5673 gold badges39 silver badges56 bronze badges
nirnir

closed as not a real question by finnw, Josh Darnell, Marnix van Valen, Filburt, kapaAug 10 '12 at 8:29

Serial Number Generator Formula Excel

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

You don't state any specific requirements but you can use a GUID.

Jay RiggsJay Riggs
47.5k9 gold badges118 silver badges135 bronze badges

I have used this CodeProject Article before when I've needed to do the same thing for projects I have worked on recently. I found it very detailed and while I didn't use everything in the sample I did get a lot out of it. (I have no affiliation with CodeProject or the author)

Additionally there is a library which gives you all this functionality complete with license file replacement and heaps of other features, but its not free, and unfortunately I couldn't remember the link. I'm sure a bit of Googgling and you'll find it.

AshNumberAsh
9,23230 gold badges93 silver badges139 bronze badges
Bo Persson
79.4k17 gold badges126 silver badges185 bronze badges

Serial Number Generator C#

vijayvijay

Try a number you can test using Luhn's algorithm. That way, you can make it long an inscrutable, yet still easily confirmed. The article contains a link to a C# implementation.

Generate Serial Number Stata

Traveling Tech Guy

Generate Serial Number From Mac Address

Traveling Tech Guy
15.7k16 gold badges84 silver badges140 bronze badges

Generate Serial Number In Oracle

Not the answer you're looking for? Browse other questions tagged c#licensinglicense-key or ask your own question.