[Catalyst] Confirmations numbers for Humans

Christopher H. Laco claco at chrislaco.com
Thu Mar 2 16:34:26 CET 2006


Bill Moseley wrote:
> I'm curious about those short airline confirmation ids.
> My last airline confirmation number was BU8743, which is a lot easier
> to say over the phone than, say, a UUID or md5 hash.  But, their
> unique-ness is, well, less unique.  I assume those confirmation
> numbers are only valid for some defined period of time.
> 
> Is anyone generating short ids like those airline confirmation
> numbers?
> 
> How are you generating them and what actions do you use to
> keep them unique?  What's your system for deciding when to purge old
> ids and how to recycle them?  If you do purge them, do you have a
> separate way to lookup a transaction after they are purged?
> 
> I suppose to create them I could truncate a MD5 hash and then test the
> database to see if it exists (using a serializable transaction
> isolation level).  I've used other metheds such as creating a random
> hex number and appending a day number sequence.

Somewhat related to your question...this may be of help..

http://search.cpan.org/~mwx/Data-Uniqid-0.11/Uniqid.pm

Data::Uniqid provides three simple routines for generating unique ids.
These ids are coded with a Base62 systen to make them short and handy
(e.g. to use it as part of a URL).

  suinqid
    genrates a very short id valid only for the localhost and with a
    liftime of 1 day

  uniqid
    generates a short id valid on the local host

  luniqid
    generates a long id valid everywhere and ever



-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060302/ac6500d8/attachment.pgp 


More information about the Catalyst mailing list