Beispiel #1
0
 /// <summary>
 /// 获取文件的MD5值,可能抛出异常
 /// </summary>
 /// <param name="filepath">文件路径</param>
 /// <param name="charcase">字符大小写,默认小写</param>
 /// <returns>获取大的MD5值</returns>
 public static string GetFileMd5Value(string filepath, CharCaseEnum charcase = CharCaseEnum.LOWER)
 {
     byte[] content = FileToBytes(filepath);
     if (content == null)
     {
         return(null);
     }
     return(EncryptUtils.GetBytesMd5Value(content, charcase));
 }
Beispiel #2
0
 /// <summary>
 /// 获取字符串的MD5值
 /// </summary>
 /// <param name="str">字符串</param>
 /// <param name="encode">编码格式</param>
 /// <param name="charcase">字符大小写</param>
 /// <returns>MD5值</returns>
 public static string GetMd5Value(this string str, Encoding encode, CharCaseEnum charcase = CharCaseEnum.LOWER)
 {
     byte[] content = encode.GetBytes(str);
     return(EncryptUtils.GetBytesMd5Value(content, charcase));
 }