MD5 Progress on Large Files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWljaGFlbCBTbGF0dGVyeQ==?=

    MD5 Progress on Large Files

    Is there any way to get progress from FileStream or MD5CryptoServic eProvider
    while generating MD5 Hashes on large files (>4GB).

    Or can I use a byte buffer to generate MD5 hashs that combine to create a
    final hash?

    StringBuilder sb = new StringBuilder() ;
    MD5 md5 = new MD5CryptoServic eProvider();
    byte[] hash = md5.ComputeHash (fs);
    fs.Close();
    foreach (byte hex in hash)
    sb.Append(hex.T oString("x2"));
    return sb.ToString();

    Thanks,
    Mike S
  • Jon Skeet [C# MVP]

    #2
    Re: MD5 Progress on Large Files

    Michael Slattery <slats@newsgrou ps.nospamwrote:
    Is there any way to get progress from FileStream or MD5CryptoServic eProvider
    while generating MD5 Hashes on large files (>4GB).
    You could wrap your stream with a ProgressIndicat orStream (this doesn't
    exist, I'm just making it up) which passes all the requests through to
    an underlying stream and raises events when it's read a certain amount.
    Sorry, I'm not expressing myself particularly well - does that make
    sense?
    Or can I use a byte buffer to generate MD5 hashs that combine to create a
    final hash?
    I don't think that would be as nice as doing it on a single stream.

    --
    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

    • Henning Krause [MVP - Exchange]

      #3
      Re: MD5 Progress on Large Files

      Hello,

      see
      http://www.infinitec.de/articles/dev...ssreports.aspx.

      Best regards,
      Henning Krause

      "Michael Slattery" <slats@newsgrou ps.nospamwrote in message
      news:99463558-216B-44D3-9BBA-4B6349D67314@mi crosoft.com...
      Is there any way to get progress from FileStream or
      MD5CryptoServic eProvider
      while generating MD5 Hashes on large files (>4GB).
      >
      Or can I use a byte buffer to generate MD5 hashs that combine to create a
      final hash?
      >
      StringBuilder sb = new StringBuilder() ;
      MD5 md5 = new MD5CryptoServic eProvider();
      byte[] hash = md5.ComputeHash (fs);
      fs.Close();
      foreach (byte hex in hash)
      sb.Append(hex.T oString("x2"));
      return sb.ToString();
      >
      Thanks,
      Mike S

      Comment

      Working...