My C # is rusty, but will be:
byte[] retVal = md5.ComputeHash(file);
really read in the whole file? I think this is just hashing a stream object. I believe you need to read the stream and then the hash to the whole file?
int length = (int)file.Length; // get file length buffer = new byte[length]; // create buffer int count; // actual number of bytes read int sum = 0; // total number of bytes read // read until Read method returns 0 (end of the stream has been reached) while ((count = file.Read(buffer, sum, length - sum)) > 0) sum += count; // sum is a buffer offset for next reading byte[] retVal = md5.ComputeHash(buffer);
I'm not sure if this really works as it is, but I think something along these lines will be necessary.
bubba source share