Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: How to generate a UUID?

From: sunandadh:aol at: 17-Jan-2002 14:05

[greggirwin--mindspring--com] writes:
> OK, so the only thing we have to do, if I understand things correctly, is to > come up with a unique string of data and checksum/secure will generate a > hash from that which is very likely *also* unique. :)
Nice analysis! Which bounces us (if I'm following right) right back to the original question. My take on it is to get a guaranteed unique string (given there are guarantees in this world) that will work across the world, it needs three parts: pppp-rrrr-ssss where pppp - PREFIX issued by a central and trusted server somewhere. You may only need to get one prefix per installation of your application so we don't have a great overhead in getting this. rrrr - RANDOM. Is some random number we add to that prefix. This part is optional, IF you believe the central server will never, ever, fail or be restarted, or hacked so that it produces (very occasionally) duplicate unique prefixes, THEN you can dispense with it. On the other hand, how long it is indicates your faith in the central server. So all the UUIDs in your application begin pppp-rrrr- That leaves ssss SERIAL. The serial part that YOU assign in YOUR application. It's your job to make sure that these are always and forever unique within the application. Put the three together, and you may have a unique ID. (I used to work in the automotive industry. Every vehicle in the world, on leaving its factory, has a unique VIN -- Vehicle Identification Number -- stamped on its chassis. Do you want to know how many vehicles share the same VIN through manufacturing IT cock-ups? The answer is an embarrassingly large number, even with short-run luxury car makers.) I got code somewhere that generates ssss's. Maybe IOS could offer a pppp service, and then we'd be ready to roll. Sunanda.