static byte[] md5sum(string file, int trim) { using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { Stream storm = null; if (trim != 0) { //fs.SetLength(fs.Length - trim); storm = new StreamTruncate(fs, trim); } else { storm = fs; } System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); return(md5.ComputeHash(storm)); } }
static byte[] md5sum(string file, int trim) { using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { Stream storm = null; if (trim != 0) { //fs.SetLength(fs.Length - trim); storm = new StreamTruncate(fs, trim); } else { storm = fs; } System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); return md5.ComputeHash(storm); } }