[REBOL] Re: How to generate a UUID?
From: sunandadh:aol at: 18-Jan-2002 19:06
Hi Joel,
> Imagine a Rugby-based registry that works as follows:
>
> - A developer submits a well-defined set of parameters (e.g.
> developer's name, company (if relevant), project, version,
> date) to a Rugby service.
>
> - The reponse is an ID guaranteed to be unique because only
> (the single instance of!) that service distributes them.
>
> - Anyone can subsequently supply the ID to the service and get
> back the identification data from the initial request.
I see this as potentially problematic as the service must either:
-- Have a hashing algorithm that is guaranteed never to clash on different
strings. This takes us back to the "how unique is checksum/secure" question;
or
-- Keep a database of the parameters and the UUID issued for it. I wouldn't
trust a database to keep its data clean enough for this over the potential
decades of life cycle. Also, keeping a database means someone can't use the
service anonymously
My thoughts for the equivalent service was that it could just issue an
integer.
One way that could be done:
Issue an integer based on the exact UTC time as got from a trusted atomic
clock service. That way, no database needed--just some instore memory to
check you didn't just issue that number a microsecond ago. (And a little bit
of code to check that the clock hasn't gone backwards during a leap-second
removal).
If the service returned a signed 64 bit integer which was (in effect) number
of microseconds from 01/Jan/2002, it could issue a million unique numbers a
second for nearly 300,000 years....It might then be safe to start again from
zero as many of the early applications will have been retired. If not, we
could always use that 64th bit and gain another 300,000 years before
upsetting our users.
This isn't really a full-blown UUID process because it couldn't handle more
than 1,000,000 requests a second.
But remember, my model was that we are producing a unique prefix. It's up to
the application to generate its own serial number. The serial number alone
makes the thing unique within the application. Appending it to the number
from the UUID service produces something that should be unique across the
earth.
More complications ensure if you want a UUID that is unique across the solar
system.
Sunanda.