Guid's

Linas Vepstas linas@linas.org
Thu, 26 Jul 2001 15:58:10 -0500


On Thu, Jul 26, 2001 at 09:27:03PM +1200, Rob Brown-Bayliss was heard to remark:
>  
> > Scratch that. Probably unique in the entire universe.
> > 
> > 2^128 = 10^38
> 
> Yes, it's a big number.  And this is getting a liuttle off topic, but I
> just read the man page for uuidgen and by default it pics random numbers
> if it thinks the system is upto it, or else uses the time and ethernet
> hardware adress.  

ethernet hardware addresses are unique, they are handed out in chunks
to the different vendors.  Vendors carve em up by model, and increment by
one as each one rolls off the assembly line.  (if two ethernet adapters
had the same h/w address, they wouldn't be able to talk, and outside traffic
meant for one would be picked by the other.  hardware addresses are 48 bits, 
so they're handed out liberally to vendors.)

> So, even bing a very very big number, useing a random number generator

Well, for stuff like this, one doesn't (shouldn't) use a random number generator.
(because they're not at all random when fed the same seed value; and historically
have been known to be less random than first thought to be.) Usually, entropy 
is used, and most os's these days have built-in entropy pools.  Things like 
mouse movements and keyboard presses are used to feed the entropy, and the pools 
usually have a monitor to help make sure the entropy hasn't run low.  Linux, and 
I assume others, save the entropy between reboots, so that the pool isn't empty 
immediately after reboot. man urandom.

Dave went even more overboard when creating the gnucash guid generator.
Take a look at guid_init in src/engine/guid.c

--linas

-- 
I'm very PUBLIC-MINDED, I'm helping a NIGERIAN get his $25,000,000 back!