MD5Helper.cs 385 B

12345678910111213141516171819
  1. using System.IO;
  2. using System.Security.Cryptography;
  3. namespace ET
  4. {
  5. public static class MD5Helper
  6. {
  7. public static string FileMD5(string filePath)
  8. {
  9. byte[] retVal;
  10. using (FileStream file = new FileStream(filePath, FileMode.Open))
  11. {
  12. MD5 md5 = MD5.Create();
  13. retVal = md5.ComputeHash(file);
  14. }
  15. return retVal.ToHex("x2");
  16. }
  17. }
  18. }