MD5加密

 public static string GetMd5String(string str)
       {
           MD5 md5 = MD5.Create();
           byte[] buffer = System.Text.Encoding.UTF8.GetBytes(str);
           byte[] md5Buffer = md5.ComputeHash(buffer);
           StringBuilder sb = new StringBuilder();
           foreach (byte b in md5Buffer)
           {
               sb.Append(b.ToString("x2"));//格式
           }
           return sb.ToString();
       }

posted on 2017-02-02 14:37  就酱紫吧、  阅读(87)  评论(0编辑  收藏  举报