Re: Pin generation algorithm question

From: Peter Pearson (
Date: 04/22/04

Date: Thu, 22 Apr 2004 09:01:21 -0700

Kees Snijders wrote:

> I could use some help in coming up with a pin generation algorithm.
> It has the following requirements:

Congratulations for starting in the right place. If you don't
have clear requirements, you won't know when you've arrived.

> All generated pins must be unique over the lifetime of the
> application.

As Ernst Lippe points out, this requires permanent memory in
the pin-generation system. Might it be acceptable to have just
a low probability of collision? In which case, the number of
PINs required becomes important.

> A pin must be sufficiently random to discourage attacks.

What constitutes an attack? If I can guess at PINs for
free (Is this a PIN? Is THIS a PIN? . . . ) then all is

> A pin must be 16 digits in lenth.

This is a peculiar requirement. Is this 16-digit figure
required for compatibility with an existing system? Or is
it an attempt to capture some less visible requirement on
the level of security?

> No reliance on the 'secrecy' of the algorithm can be made.

By "the algorithm," do you mean the PIN-generating algorithm,
excluding perhaps a secret key?

> Nice to have:
> Some characteristic which could be used to recognise a pin with some
> degree of certainty.

If this characteristic becomes known, that will vitiate the
"sufficiently random to discourage attacks" requirement . . . right?

> I was thinking of combining a sequence and a pseudo random number.
> Say 10 digits for the sequence and 6 digits for the random number.
> If the sequence itself could contain some 'randomness' based on a key
> that could be altered for each execution of my pin-generator but still
> guarantee uniqueness, that would help the cause.

So you're thinking of something like a mapping from 10-digit sequence
numbers onto a 6-digit check field, where the mapping algorithm isn't
secret . . . right? . . . but can involve a secret key . . . right?
And you use the same algorithm and secret key in the field to verify
that a PIN is valid, right? And you hope that bad guys won't extract
the secret key from the validating device, right?

Is this helping?
- Peter