*goes back and actually reads the documentation for HashAlgorithm.HashSize*
"Gets the size of the computer hash code in *bits*." (my emphasis)
D'Oh!
--
Ian Griffiths
DevelopMentor
- Original Message -
From: "Joel Mueller" <[EMAIL PROTECTED]>
> An MD5 hash is actually only 16 bytes,
mailto:[EMAIL PROTECTED]]
> On Behalf Of Erick Thompson
> Sent: Monday, April 29, 2002 12:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [DOTNET] Confirm string GetHashCode reflects
> string, not object
>
>
> There is no reason not to store the strings, except that I
> was a lit
> But the question I would ask is are you actually wasting more space by
> storing MD5 hashes than you would be by just remembering the strings in
the
> first place? Unless your strings are on average longer than 128 bytes
(the
> size of an MD5 hash) then it will actually be rather more expensive
> Ian Griffiths spake:
> MD5 is believed to
> be a good hash algorithm, and it has a length of 128 bytes (i.e.
> 1024 bits)
Actually MD5 is 128 *bits*, that is 16 bytes...
--
Peter
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor list
To answer your original question though, the string's hash function *has* to
be based on the string value, not the object identity. (So interning or
lack thereof will not affect you.) This is because the String class
overrides Equals. Any class that overrides Equals is *required* to override
Ge
Upon further reflection, I think that using GetHashCode isn't a good idea to
check if I've seen a string before. I think I'll use a MD5 sig instead, so I
don't have to worry about collisions.
Erick
- Original Message -
From: "Erick Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Se