Computing MD5SUM of large files in C#

Posted by spkhaira on Stack Overflow See other posts from Stack Overflow or by spkhaira
Published on 2009-04-30T07:11:25Z Indexed on 2010/03/19 19:11 UTC
Read the original article Hit count: 581

Filed under:
|
|
|

I am using following code to compute MD5SUM of a file -

byte[] b = System.IO.File.ReadAllBytes(file);
string sum = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(b));

This works fine normally, but if I encounter a large file (~1GB) - e.g. an iso image or a DVD VOB file - I get an Out of Memory exception.

Though, I am able to compute the MD5SUM in cygwin for the same file in about 10secs.

Please suggest how can I get this to work for big files in my program.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about md5