Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-05-01 Thread Ian Griffiths
*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,

Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-04-30 Thread Joel Mueller
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

Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-04-29 Thread Erick Thompson
> 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

Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-04-27 Thread Peter Stephens
> 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

Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-04-27 Thread Ian Griffiths
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

Re: [DOTNET] Confirm string GetHashCode reflects string, not object

2002-04-26 Thread Erick Thompson
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