473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MD5 Progress on Large Files

Is there any way to get progress from FileStream or MD5CryptoServiceProvider
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 MD5CryptoServiceProvider();
byte[] hash = md5.ComputeHash(fs);
fs.Close();
foreach (byte hex in hash)
sb.Append(hex.ToString("x2"));
return sb.ToString();

Thanks,
Mike S
Jun 8 '07 #1
2 2154
Michael Slattery <sl***@newsgroups.nospamwrote:
Is there any way to get progress from FileStream or MD5CryptoServiceProvider
while generating MD5 Hashes on large files (>4GB).
You could wrap your stream with a ProgressIndicatorStream (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 - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 8 '07 #2
Hello,

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

Best regards,
Henning Krause

"Michael Slattery" <sl***@newsgroups.nospamwrote in message
news:99**********************************@microsof t.com...
Is there any way to get progress from FileStream or
MD5CryptoServiceProvider
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 MD5CryptoServiceProvider();
byte[] hash = md5.ComputeHash(fs);
fs.Close();
foreach (byte hex in hash)
sb.Append(hex.ToString("x2"));
return sb.ToString();

Thanks,
Mike S
Jun 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brian Birtle | last post by:
**** A CHALLENGE TO THE GURUS - refute the statement "It's impossible to build a file upload progress meter using ASP.NET" **** First person to prove me wrong gets "All Time .NET Programming GOD"...
11
by: brother52 | last post by:
I am using My.Computer.FileSystem.CopyFile() to copy a bunch of files from one directoy to another, and would like to display a progress bar on the screen for each file being copied. Is this...
8
by: WhiteWizard | last post by:
I guess it's my turn to ASK a question ;) Briefly my problem: I am developing a Windows app that has several User Controls. On one of these controls, I am copying/processing some rather large...
4
by: Joachim | last post by:
Is there an efficient way of copying a file and at the same time updating a progress bar with short intervals to see how much is still to copy of the file? Like some FTP programs have for instance.
6
by: kimiraikkonen | last post by:
Hi, I use system.io.file class to copy files but i have a difficulty about implementing a basic / XP-like progress bar indicator during copying process. My code is this with no progress bar,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.