首页 > 代码库 > 获取文件Md5值
获取文件Md5值
private static string GetFileMD5(string filePath) { string _md5Value = http://www.mamicode.com/string.Empty; try { if (System.IO.File.Exists(filePath)) { FileStream file = new FileStream(filePath, FileMode.Open); System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] retVal = md5.ComputeHash(file); file.Close(); file.Dispose(); _md5Value= BitConverter.ToString(retVal).Replace("-", ""); } return _md5Value; } catch (Exception ex) { //throw new Exception(string.Format("GetFileMD5_Error_{0}_{1}", DateTime.Now, ex.Message)); return _md5Value; } }
获取文件Md5值
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。