Does anyone know the technique used by System.Guid.NewGuid() to create the
Guid ?
C# code would be great !
Joseph Bittman MCSD - 08 Oct 2005 02:32 GMT
October 7, 2005
I know in VB:
Dim G as Guid = Guid.NewGuid
In C# I believe:
dim guid G = Guid.NewGuid
I hope I got the C# right, although probably now... (the truth is NewGuid()
returns a new guid object). Hope this helps!

Signature
Joseph Bittman
Microsoft Certified Solution Developer
Web Site: http://71.39.42.23/
Static IP
> Does anyone know the technique used by System.Guid.NewGuid() to create the
> Guid ?
>
> C# code would be great !
Joe Kaplan (MVP - ADSI) - 08 Oct 2005 04:01 GMT
Do you mean the call that actually generates a Guid randomly? It is a
p/invoke call down into the Windows API CoCreateGuid or perhaps directly
down to UuidCreate.
Joe K.
> Does anyone know the technique used by System.Guid.NewGuid() to create the
> Guid ?
>
> C# code would be great !
Richard Grimes - 19 Oct 2005 17:22 GMT
> Do you mean the call that actually generates a Guid randomly? It is a
> p/invoke call down into the Windows API CoCreateGuid or perhaps
> directly down to UuidCreate.
Rotor says it uses CoCreateGuid
Richard

Signature
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Sahil Malik [MVP] - 09 Oct 2005 07:41 GMT
John,
GUID is a pseudo-random number, it may repeat - but the probability of it's
repetition is so low that you can safely assume that it will never repeat.
The actualy GUID generation algorithm has changed over the years. GUID is
Microsoft's implemetnation of UUID, which is the real standard. GUID at one
point of time contained the network card MAC address info - which meant the
exact machine the GUID came from can be traced back - which sucks, and which
is what was exploited in the mellisa worm.
There exist other algorithms to create UUIDs. If you are interested in
reading a sample, it's right here
http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------
The hardware info used is the unique chip #, network card info, and
something else that I forget. About 40 bits are assigned to that
> Does anyone know the technique used by System.Guid.NewGuid() to create the
> Guid ?
>
> C# code would be great !