zoukankan      html  css  js  c++  java
  • md5 helper

    public static string ToMD5Hash(this string str)
    {
        if (string.IsNullOrEmpty(str))
            return null;
    
        return Encoding.ASCII.GetBytes(str).ToMD5Hash();
    }
    
    public static string ToMD5Hash(this byte[] bytes)
    {
        if (bytes == null || bytes.Length == 0)
            return null;
    
        using (var md5 = MD5.Create())
        {
            return string.Join("", md5.ComputeHash(bytes).Select(x => x.ToString("X2")));
        }
    }
  • 相关阅读:
    2-7
    2-6
    2-5
    2-4
    2-3
    2-1
    2-2
    1-1
    5-7
    第六章例6-1
  • 原文地址:https://www.cnblogs.com/dayang12525/p/11791865.html
Copyright © 2011-2022 走看看