File checksum

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

    File checksum

    Hi,

    Once I heard something about a files checksum. Is there a
    smart way to verify to some degree that the content of a
    file has not been changed in C#.

    best regards Jesper.
  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: File checksum

    Hi,

    You can compute a hash value (MD5 or SHA) on a file content, store it
    somewhere and then re-compute the hash and compare to the stored value. If
    they are not equal, the file has changed. .NET Framework has a built-in
    implementation for hash computation in the System.Security .Cryptography
    namespace.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio

    Bring the power of unit testing to VS .NET IDE

    "Jesper." <anonymous@disc ussions.microso ft.com> wrote in message
    news:055001c3ad ca$76d3fff0$a40 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > Once I heard something about a files checksum. Is there a
    > smart way to verify to some degree that the content of a
    > file has not been changed in C#.
    >
    > best regards Jesper.[/color]

    Comment

    • Jochen Kalmbach

      #3
      Re: File checksum

      Jesper. wrote:
      [color=blue]
      > Once I heard something about a files checksum. Is there a
      > smart way to verify to some degree that the content of a
      > file has not been changed in C#.[/color]

      The recommended way is to use a CVS-System like (CVS, PVCS, SourceSafe,
      ClearCase, ...)

      --
      Greetings
      Jochen

      Do you need a memory-leak finder ?

      Comment

      • csharpguru@linhnguyen.com

        #4
        Re: File checksum


        Hash the file content.

        To check for file modification:
        Rehash the file content and compare to the above

        <Linh Nguyen />
        [color=blue]
        >-----Original Message-----
        >Jesper. wrote:
        >[color=green]
        >> Once I heard something about a files checksum. Is there[/color][/color]
        a[color=blue][color=green]
        >> smart way to verify to some degree that the content of[/color][/color]
        a[color=blue][color=green]
        >> file has not been changed in C#.[/color]
        >
        >The recommended way is to use a CVS-System like (CVS,[/color]
        PVCS, SourceSafe,[color=blue]
        >ClearCase, ...)
        >
        >--
        >Greetings
        > Jochen
        >
        > Do you need a memory-leak finder ?
        > http://www.codeproject.com/tools/leakfinder.asp
        >.
        >[/color]

        Comment

        Working...