MD5 hashing vs GetHashcode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MuZZy

    MD5 hashing vs GetHashcode

    Hi,

    Is there any guarantee that MD5 hashing algorithm implementation will
    not change in the next .NET version unlike what's happened to
    String.GetHashc ode?

    Thank you,
    MuZZy
  • Dale

    #2
    RE: MD5 hashing vs GetHashcode

    What exactly are you asking or implying? Since the results of GetHashcode
    shouldn't be persisted - it is only intended for equality comparisons - then
    it shoudln't matter if the results change.

    GetHashCode is also not intended to provide security for data.

    I'll admit I have never tried to compare the hash results between versions
    of the .Net framework but if you're implying that the results of
    Cryptography.MD 5 is different between versions of the .Net framework, then
    Microsoft has a problem.

    The fact is, though, that there's nothing in the documentation of
    String.GetHashc ode that says it is MD5. In fact, it says specifically:

    "The behavior of GetHashCode is dependent on its implementation, which might
    change from one version of the common language runtime to another. A reason
    why this might happen is to improve the performance of GetHashCode. If you
    require the behavior of GetHashCode be constant, override the runtime
    implementation of GetHashCode with an implementation of your own that you
    know will never change."

    So the short answer to your question is, "No, there is no guarantee."

    --
    Dale Preston
    MCAD C#
    MCSE, MCDBA


    "MuZZy" wrote:
    [color=blue]
    > Hi,
    >
    > Is there any guarantee that MD5 hashing algorithm implementation will
    > not change in the next .NET version unlike what's happened to
    > String.GetHashc ode?
    >
    > Thank you,
    > MuZZy
    >[/color]

    Comment

    • Dale

      #3
      RE: MD5 hashing vs GetHashcode

      Read my reply to your earlier post. I wrote my first reply here before
      seeing your other post. After reading that one, I better understood what you
      were asking. As I stated there, MD5, and others such as the SHA series of
      hash algorithms, are true cryptographic hashes and, other than fixing flaws
      in the implementations , should remain consistent over versions.

      And as I stated in the first reply to this post, the string.GetHashC ode
      documentation for version 1.1 specifically states there is no guarantee of
      compatability between versions of GetHashCode.

      I feel for ya, buddy. When I saw your post about a HUGE problem with
      hashcodes, my first reaction was, "How could someone have a huge problem with
      hashcodes?"

      You are right though. You have a huge problem with hashcodes :). Good luck
      with it though.

      Dale Preston
      MCAD C#
      MCSE, MCDBA


      "MuZZy" wrote:
      [color=blue]
      > Hi,
      >
      > Is there any guarantee that MD5 hashing algorithm implementation will
      > not change in the next .NET version unlike what's happened to
      > String.GetHashc ode?
      >
      > Thank you,
      > MuZZy
      >[/color]

      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: MD5 hashing vs GetHashcode

        MuZZy <tnr@newsgroups .nospam> wrote:[color=blue]
        > Is there any guarantee that MD5 hashing algorithm implementation will
        > not change in the next .NET version unlike what's happened to
        > String.GetHashc ode?[/color]

        No, the implementation could change. The *results* won't, however, as
        they're specified (unlike String.GetHashc ode).

        --
        Jon Skeet - <skeet@pobox.co m>
        http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
        If replying to the group, please do not mail me too

        Comment

        Working...