[REBOL] Re: How to generate a UUID? (was possible data format... Re: Re: dbms3.r
From: greggirwin::mindspring::com at: 16-Jan-2002 1:48
<< This little line reminded me that I had this as an outstanding question
in my mind. How exactly does one generate a UUID? And perhaps (useful to
Gabriele too) has got a function that does this? >>
Under Win32, you can use the CoCreateGUID function. It uses an OSF DCE
specified algorithm based on:
The current date and time.
A clock sequence and related persistent state to deal with retrograde
motion of clocks.
A forcibly incremented counter to deal with high-frequency allocations.
The globally unique IEEE machine identifier.
I've built custom object IDs using the timestamp, counter, and machine
identifier, along with a "type" ID which specified the kind of object, but I
still used CoCreateGUID to get the machine ID. I've also done it where the
machine ID was pulled from a file which was part of the configuration
process for the software.
I'm not sure what would be the best portable solution, or if there is a
single best solution, but you could probably concoct something reasonably
reliable by storing a timestamp, and maybe some other info, when the
make-guid script is run the first time, or if the info file has been
deleted. Basically, the machine ID part is replaced by the installation
timestamp and maybe something like the CHECKSUM(s) of some randomly selected
files on the system.