字符串MD5加密运算

时间:2015-07-15 22:13:36   收藏:0   阅读:186

 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();
       }

原文:http://www.cnblogs.com/hsha/p/4649459.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!