Re: Comparing GUIDs

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mattias Sjögren (mattias.dont.want.spam_at_mvps.org)
Date: 05/26/04


Date: Wed, 26 May 2004 21:15:15 +0200


>IF guid1.GetHashCode=guid2.GetHashCode THEN ....
>
>I've never had any problem with using this code.

That doesn't mean it's correct. A GUID is 128 bits of data, a hash
code only 32. So many many different GUIDs could return the same value
in theory.

Since there is an Equals method, I don't see why you would use
anything else.

Mattias

-- 
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Relevant Pages

  • Re: One-way hashing of UUID
    ... number, and the UUID is effectively a one-way hash itself, if I remember ... A GUID is calculated based on your network card MAC ... only have a Dial-up Adapter, or no network cards, then the GUID is less ... string as encryption sometimes leads to characters with ASCII zero. ...
    (microsoft.public.vb.general.discussion)
  • get hash of a file
    ... I am trying to get HASH of contants of a file that I read. ... I get bytefrom ComputeHash(). ... To get alpha-digits I put it into Guid to get Guid out of it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Binary compatability?
    ... You use the Guid attribute at the assembly level: ... Mattias Sjögren [MVP] mattias @ mvps.org ... Please reply only to the newsgroup. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Letter of claim - p2p
    ... GUID) only for the first 30 or so IPs, then it just stops listing any ... GUID, filesize or Hash values. ... There are many shareaza / emule clients ...
    (uk.legal)
  • Re: Guid question
    ... thx jon. ... They work great but they are very large in string form (38 ... > I agree with those who say just use the full 16-byte binary Guid. ... > decent hash. ...
    (borland.public.delphi.non-technical)