Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

GUID Generator

Hi all,

Is it just me, or has Microsoft recently changed their
GUID generator ? I could swear that the last 48 bits (12
positions) used to be the NIC address and were the same
for a given machine, but when I run the GUID tool in
VS .Net, I get what seems to be a completely different
number each time, no more const-ness in the last 48 bits.

This probably is a good thing as it makes GUIDS more "random", but I'd like to see some explanation somewhere - and so far I couldn't find anything.

Any input would be appreciated.

Tuesday, November 19, 2002

Yes, GUIDs used to contain the MAC address of the generating machine. This was changed several years ago in an attempt to preserve privacy: Microsoft Office documents contain several GUIDs, and people were able to track them back to the originating machine, in instances where the author thought he was anonymous.

These days, a GUID consists primarily of random bits. (There is a format field that says what kind of GUID it is, and this is set to "random" instead of "sequential".)

If you want/need the original behavior, do a P/Invoke call to 'UuidCreateSequential'.

Jim Lyon
Tuesday, November 19, 2002

Thanks Jim. You wouldn't happen to know when the change
was made or where I could find the official MS document
on that, would you ?

Thanks again.

Wednesday, November 20, 2002

From the MSDN documentation, it looks like this change was made in Windows 2000. I don't know if it was ever retro-fitted into any of the Windows 9x line in a service pack.

See the MSDN documentation for UuidCreate and UuidCreateSequential.

Jim Lyon
Wednesday, November 20, 2002

Thanks again. This is enough for what I need.
It's kind of strange though that MS hasn't given it
more publicity. Besides, it wouldn't hurt to know what
algorithm they use now, at least in broad strokes - I mean, is it still a 60-bit timestamp plus something else, and what
that "something sles" is. Oh well...

Thursday, November 21, 2002

The algorithm they're using now is a cryptographically strong random number generator. What generator specifically I have no idea.

Chris Tavares
Thursday, November 21, 2002

I don't have first-hand knowledge, but I've been told that the GUID generator uses an RC-2 stream, initialized at boot time with as many sources of unpredictability as they can find (including, for example, the current address in the DMA counter used for memory refresh).

Jim Lyon
Thursday, November 21, 2002

*  Recent Topics

*  Fog Creek Home