Click to See Complete Forum and Search --> : PIN Generation Algorithm


dvg
January 24th, 2003, 11:30 AM
Hi,

I'm looking for some help in developing a PIN generation algorithm for scratch cards. What I would like to do is take a range of "control numbers" (a sequential number representing a batch of PINs) and generate a 10-14 digit PIN based on that. I'm not looking for a random number generation, but something that will generate a pseduo-random number based on the control number. To further complicate the issue, the PINs would need to be unique over a large range control numbers (1M+).

I've experimented with different operations like MOD and shifting and I get a nice range of random PINs. But I cannot seem to figure out how to make the number unique over the range I'm looking for. I know it can be done but the math to develop / prove it is beyond me.

And suggestions or references would be appreciated. I understand that something like this is very propriety to a business so I'm not necessary looking for a complete solution, just a point in the right direction.

Below is an example of what I'm trying to do. Thanks in advance for the help,
David


Control # PIN

00000001 123.456.789.123
00000002 638.098.270.748
00000003 472.309.327.732
0000nnnn 852.382.127.034

lord loh
February 17th, 2003, 12:58 AM
I know that this is not secure but It may be unique...This is only a wild guess...

Do an 'MD5' of 'UNIX TIME STAMP'. Start replacing one character with another(to disuise the obvious MD5) and add a few more characters(random)....

What might be the disadvantage ?
Not very scientific isn't it ?

Mike Harnad
February 18th, 2003, 05:05 PM
You might want to take a look at Globally Unique IDs (GUIDs). Visual C++ ships with a program called Guidgen that generates them for you.