CRC .NET

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

    CRC .NET

    Hello,
    Is there a framework class that implements CRC 32 algorithms. I could not
    find on msdn, I just want to make sure that I didn't miss it.
    If not can anyone explain how CRC32 algorithm can be implemented.

    Thank you




  • Jon Skeet [C# MVP]

    #2
    Re: CRC .NET

    Larry <lp@nospam.co m> wrote:[color=blue]
    > Is there a framework class that implements CRC 32 algorithms. I could not
    > find on msdn, I just want to make sure that I didn't miss it.
    > If not can anyone explain how CRC32 algorithm can be implemented.[/color]

    There are plenty of sample implementations around on the web, including
    ones in C#.

    Do a google search for crc32 and C#, and you'll find lots.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • William Stacey [MVP]

      #3
      Re: CRC .NET

      I would use SHA1.ComputeHas h(stream).

      --
      William Stacey [MVP]

      "Larry" <lp@nospam.co m> wrote in message
      news:ubbO5QKbFH A.1384@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hello,
      > Is there a framework class that implements CRC 32 algorithms. I could not
      > find on msdn, I just want to make sure that I didn't miss it.
      > If not can anyone explain how CRC32 algorithm can be implemented.
      >
      > Thank you
      >
      >
      >
      >[/color]


      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: CRC .NET

        William Stacey [MVP] <staceywREMOVE@ mvps.org> wrote:[color=blue]
        > I would use SHA1.ComputeHas h(stream).[/color]

        It depends on what the requirement is. If it's just "a hashing
        algorithm" then SHA1 would indeed be a pretty good choice - but there
        are other hashes which are cheaper to calculate but still good at
        preventing *accidental* corruption (rather than deliberate tampering).
        Adler32 is better than CRC32 in this respect, I believe.

        However, my guess is that the OP actually needs to work out a CRC32
        hash to match something else which is already working out a CRC32
        hash...

        --
        Jon Skeet - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        • William Stacey [MVP]

          #5
          Re: CRC .NET

          If Larry still needs some CRC32, I posted a small sample project at:
          http://spaces.msn.com/members/staceyw/Blog/cns!1pnsZpX0fPv DxLKC6rAAhLsQ!4 02.entry

          --
          William Stacey [MVP]

          "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
          news:MPG.1d11ef efc4e2734698c2a 7@msnews.micros oft.com...[color=blue]
          > William Stacey [MVP] <staceywREMOVE@ mvps.org> wrote:[color=green]
          >> I would use SHA1.ComputeHas h(stream).[/color]
          >
          > It depends on what the requirement is. If it's just "a hashing
          > algorithm" then SHA1 would indeed be a pretty good choice - but there
          > are other hashes which are cheaper to calculate but still good at
          > preventing *accidental* corruption (rather than deliberate tampering).
          > Adler32 is better than CRC32 in this respect, I believe.
          >
          > However, my guess is that the OP actually needs to work out a CRC32
          > hash to match something else which is already working out a CRC32
          > hash...
          >
          > --
          > Jon Skeet - <skeet@pobox.co m>
          > http://www.pobox.com/~skeet
          > If replying to the group, please do not mail me too[/color]


          Comment

          • Larry

            #6
            Re: CRC .NET

            Thanks. I also found good resources and code on the web. They all produce
            identical CRC32 chechsum. Thanks.


            "William Stacey [MVP]" <staceywREMOVE@ mvps.org> wrote in message
            news:OIa5VrPbFH A.2288@TK2MSFTN GP14.phx.gbl...[color=blue]
            > If Larry still needs some CRC32, I posted a small sample project at:
            > http://spaces.msn.com/members/staceyw/Blog/cns!1pnsZpX0fPv DxLKC6rAAhLsQ!4 02.entry
            >
            > --
            > William Stacey [MVP]
            >
            > "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
            > news:MPG.1d11ef efc4e2734698c2a 7@msnews.micros oft.com...[color=green]
            >> William Stacey [MVP] <staceywREMOVE@ mvps.org> wrote:[color=darkred]
            >>> I would use SHA1.ComputeHas h(stream).[/color]
            >>
            >> It depends on what the requirement is. If it's just "a hashing
            >> algorithm" then SHA1 would indeed be a pretty good choice - but there
            >> are other hashes which are cheaper to calculate but still good at
            >> preventing *accidental* corruption (rather than deliberate tampering).
            >> Adler32 is better than CRC32 in this respect, I believe.
            >>
            >> However, my guess is that the OP actually needs to work out a CRC32
            >> hash to match something else which is already working out a CRC32
            >> hash...
            >>
            >> --
            >> Jon Skeet - <skeet@pobox.co m>
            >> http://www.pobox.com/~skeet
            >> If replying to the group, please do not mail me too[/color]
            >
            >[/color]


            Comment

            • Larry

              #7
              Re: CRC .NET

              Thanks. I also found good resources and code on the web. They all produce
              identical CRC32 chechsum. Thanks.


              "William Stacey [MVP]" <staceywREMOVE@ mvps.org> wrote in message
              news:OIa5VrPbFH A.2288@TK2MSFTN GP14.phx.gbl...[color=blue]
              > If Larry still needs some CRC32, I posted a small sample project at:
              > http://spaces.msn.com/members/staceyw/Blog/cns!1pnsZpX0fPv DxLKC6rAAhLsQ!4 02.entry
              >
              > --
              > William Stacey [MVP]
              >
              > "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
              > news:MPG.1d11ef efc4e2734698c2a 7@msnews.micros oft.com...[color=green]
              >> William Stacey [MVP] <staceywREMOVE@ mvps.org> wrote:[color=darkred]
              >>> I would use SHA1.ComputeHas h(stream).[/color]
              >>
              >> It depends on what the requirement is. If it's just "a hashing
              >> algorithm" then SHA1 would indeed be a pretty good choice - but there
              >> are other hashes which are cheaper to calculate but still good at
              >> preventing *accidental* corruption (rather than deliberate tampering).
              >> Adler32 is better than CRC32 in this respect, I believe.
              >>
              >> However, my guess is that the OP actually needs to work out a CRC32
              >> hash to match something else which is already working out a CRC32
              >> hash...
              >>
              >> --
              >> Jon Skeet - <skeet@pobox.co m>
              >> http://www.pobox.com/~skeet
              >> If replying to the group, please do not mail me too[/color]
              >
              >[/color]


              Comment

              Working...