Serial Number Needed!

Posted on 2006-04-16
Last Modified: 2010-04-15
Ah, got your attention.

Yes, I do need one, but for my program.

I would like the serial number to be 3 sets of 2 numbers:

Ex. 12-43-56

I would like each serial to be unique to each machine.

Any small function will do, but something unique and clever. All I come up with was using the computername which has been done a thousand times.

Some rough but working example would be great. I need some ideas to exand on.
Question by:edvinson
    LVL 14

    Expert Comment

    > Ah, got your attention.

    > I would like each serial to be unique to each machine.

    You mean generate something unique based on the hardware or os running on the pc.
    You can use a hash based on the MAC address of a network card. Or use the harddisk volume id.
    LVL 11

    Expert Comment


    A serial number of this type will give you just 1000000 possible combinations.
    Furthermore, I don't think these kind of codes are very welcomed by the user - what will happen if the user changes his network card or hard drive.
    It's highly dependant on the kinf of program you want to protect what protection to use.
    But generally in the most cases the efforts for elaborating of a certain protection do not worth themselves. The hackers out there are too good..
    It's better to pick up some simple protection mechanism and to put more of your efforts in creating of features of your software that will make the user to want to pay for it.
    LVL 16

    Expert Comment

    How about using the installation date/time in some form?

    LVL 5

    Expert Comment

    Have you tried :-)

    You could use random number generation functions..

    rand() and srand()

    LVL 6

    Accepted Solution

    Random numbers won't be unique to the machine. a 6 digit serial number isn't very many numbers. At the very least, create a long number and only use 6 internally - but don't reveal that secret to the world.

    And Paul, HDD volume id can be changed by the user. I think you must be referring to the hard drive serial number. That is unique to the drive and cannot be changed (without getting into the drive electronics).

    As for terms... serial numbers are usually assigned by the manufacturer in sequence as product is shipped. It usually isn't connected to a machine or installation. What you are probably looking for is an activation or registration number. There would be a lot of use making these tied to some constant value in your computer. Paul's suggestion of HDD serial number (corrected) or MAC address off your ethernet card are theleast changing values in you computer - using those would serve you well.

    LVL 22

    Expert Comment

    Many many network cards let you change the MAC address from the control panel.

    There is no good way of getting a deterministic and unchangeable.


    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

    Suggested Solutions

    Title # Comments Views Activity
    posix semaphore deadlock 13 101
    Way to improve it 16 57
    convert char array to number in c 5 66
    valid enum? 6 47
    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…
    Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
    The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now