Re: Creating unique, non-reproducible serial ID
Date: Thu, 08 Mar 2001 03:53:44 GMT
Message-ID: <3aa6fe86.28457599_at_news.gte.net>
On Sun, 4 Mar 2001 13:09:59 +0200, "Lior Messinger" <liorm_at_noks.com>
wrote:
>I'm looking for an algorithm to create a serial ID that I can give to users,
>encrypted in a away that they will not be able to recreate other serial IDs.
>
>Any ideas? probably an old question but still... And how about the
>similarity of problem to Credit Card ID creation?
You can make it hard, but never impossible, cuz they can always guess and guess and guess and just get lucky.
Almost any old algorithm will do, you just have to get relatively even distribution over a large range of numbers (keys, ids, whatever) that you populate sparsely.
Like, your "secret algorithm" could be that it always ends in -3, but people guessing would randomly hit another valid number one time in ten. That might even be good enough for some.
Generally, (a) have your algorithm chew up the first N characters of the key, (b) have it compute the delta to the nearest valid key, (c) append whatever is necessary to convert to a valid key, and for good luck (d) permute the characters in some obscure but deterministic manner.
Joshua Stern
JRStern_at_gte.net
Received on Thu Mar 08 2001 - 04:53:44 CET