Click here to Skip to main content
15,886,919 members
Home / Discussions / Algorithms
   

Algorithms

 
Questiongenerate unrepeated serials Pin
samira forooghi28-Mar-07 20:05
samira forooghi28-Mar-07 20:05 
AnswerRe: generate unrepeated serials Pin
Nathan Addy29-Mar-07 15:19
Nathan Addy29-Mar-07 15:19 
AnswerRe: generate unrepeated serials Pin
Tim Paaschen29-Mar-07 20:18
Tim Paaschen29-Mar-07 20:18 
GeneralRe: generate unrepeated serials Pin
Nathan Addy30-Mar-07 7:38
Nathan Addy30-Mar-07 7:38 
GeneralRe: generate unrepeated serials Pin
Tim Paaschen1-Apr-07 20:40
Tim Paaschen1-Apr-07 20:40 
GeneralRe: generate unrepeated serials [modified] Pin
cp98761-Apr-07 21:13
cp98761-Apr-07 21:13 
GeneralRe: generate unrepeated serials Pin
Nathan Addy2-Apr-07 8:58
Nathan Addy2-Apr-07 8:58 
GeneralRe: generate unrepeated serials Pin
cp98762-Apr-07 15:38
cp98762-Apr-07 15:38 
Guess we had different takes on the original question, but it does raise some interesting ideas, as long as we agree that they may have nothing to do with the original post.

I was looking at the serial number aspect, which I interpreted to be the type of alpha-numeric key type things you have to type in to install some software. Here the requirements MAY be:

1. hard to create valid serial numbers without the exact algorithm
2. easy to check if a serial number is valid

For 100,000 serial numbers, with 16 digits, if all numeric then only 10^5 of 10^16 are valid, so if the numbers appear 'random', the chance of creating one by guessing is 1 in 10^11. If the digits can be alphanumeric then the chance is lower.

Tim's approach of mangling bits from a sequence number, a random number and some hash value is a simple solution to this, likely to be adequate for many applications. However, if these numbers are to be tested for validity in the field, it is vulnerable as it places the algorithm needed to generate the serial numbers actually in the field software, so is susceptible to reverse engineering. As to whether this is a problem depends on waht you are trying to achieve.

You can make it safer using public key cryptography. For example, if you were to encrypt the blocks{serial_000001, serial_000002, serial_000003.. etc} using an RSA private key, then you could decrypt using the RSA public key in your software. Only valid serial numbers would decrypt to something of the correct form. It would be very difficult to generate valid numbers without the private key. This can only be part of a security system, but is a relatively simple way to make keys that are hard to fake.

You could generate random numbers using linear congruences, 'good' here usually refers to mathematical randomness; the uniform (or specifically shaped) distribution and lack of hidden correlation, characteristics essential for their use in monte-Carlo simulations. There is lots on the web on this, Numerical Recipes have a simple canned routine. For serial numbers though, Random numbers don't have a simple way of determining if a particular number is valid.


Peter

"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

Questionhelp me Pin
phowarso28-Mar-07 4:38
phowarso28-Mar-07 4:38 
AnswerRe: help me Pin
Newbie0028-Mar-07 5:34
Newbie0028-Mar-07 5:34 
GeneralRe: help me Pin
phowarso28-Mar-07 5:56
phowarso28-Mar-07 5:56 
GeneralRe: help me Pin
phowarso28-Mar-07 5:56
phowarso28-Mar-07 5:56 
AnswerRe: help me Pin
cp987628-Mar-07 17:19
cp987628-Mar-07 17:19 
QuestionChess genetic algorithm Pin
blashey25-Mar-07 4:01
blashey25-Mar-07 4:01 
AnswerRe: Chess genetic algorithm Pin
Paul Conrad14-Jul-07 10:20
professionalPaul Conrad14-Jul-07 10:20 
QuestionRough Set Algorithm Pin
kkadir24-Mar-07 14:05
kkadir24-Mar-07 14:05 
AnswerRe: Rough Set Algorithm Pin
Paul Conrad21-Jul-07 18:06
professionalPaul Conrad21-Jul-07 18:06 
QuestionCube and Rectangle Intersection Pin
jk chan23-Mar-07 3:03
jk chan23-Mar-07 3:03 
AnswerRe: Cube and Rectangle Intersection Pin
Dan Neely23-Mar-07 3:20
Dan Neely23-Mar-07 3:20 
QuestionMath research team maps E8! Pin
73Zeppelin19-Mar-07 20:09
73Zeppelin19-Mar-07 20:09 
AnswerRe: Math research team maps E8! Pin
Maximilien20-Mar-07 3:17
Maximilien20-Mar-07 3:17 
JokeRe: Math research team maps E8! Pin
Dan Neely20-Mar-07 5:33
Dan Neely20-Mar-07 5:33 
GeneralRe: Math research team maps E8! Pin
DavidNohejl20-Mar-07 6:48
DavidNohejl20-Mar-07 6:48 
GeneralRe: Math research team maps E8! Pin
El Corazon20-Mar-07 7:10
El Corazon20-Mar-07 7:10 
GeneralRe: Math research team maps E8! Pin
Russell Jones21-Mar-07 22:44
Russell Jones21-Mar-07 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.