I'm writing a simple checksum generator app using C# for large files. It's working quite fine, but users would like to see some sort of progress bar since the app freezes for a a few dozen seconds.
Here is a a sample of code I use (BufferedStream increased a lot the app performance):
private static string GetSHA5(string file)
{
using (var stream = new BufferedStream(File.OpenRead(file), 1200000))
{
var sha5 = new SHA512Managed();
byte[] checksum_sha5 = sha5.ComputeHash(stream);
return BitConverter.ToString(checksum_sha5).Replace("-", String.Empty);
}
}
My question is, is it possible to get the buffer "progress" ? Because I guess internally it operates some sort of division and looping.