MD5 file processing
Posted
by Ric Coles
on Stack Overflow
See other posts from Stack Overflow
or by Ric Coles
Published on 2009-08-28T09:08:11Z
Indexed on
2010/04/20
5:33 UTC
Read the original article
Hit count: 408
Good morning all,
I'm working on an MD5 file integrity check tool in C#.
How long should it take for a file to be given an MD5 checksum value? For example, if I try to get a 2gb .mpg file, it is taking around 5 mins+ each time. This seems overly long.
Am I just being impatient?
Below is the code I'm running
public string getHash(String @fileLocation)
{
FileStream fs = new FileStream(@fileLocation, FileMode.Open);
HashAlgorithm alg = new HMACMD5();
byte[] hashValue = alg.ComputeHash(fs);
string md5Result = "";
foreach (byte x in hashValue)
{
md5Result += x;
}
fs.Close();
return md5Result;
}
Any suggestions will be appreciated.
Regards
© Stack Overflow or respective owner