C# MD5 加密 string->string


        private string MD5Encode(string text)
        {
            MD5 md5 = MD5.Create();
            byte[] en = md5.ComputeHash(Encoding.Default.GetBytes(text));
            StringBuilder sBuilder = new StringBuilder();
            for (int i = 0; i < en.Length; i++)
            {
                sBuilder.Append(en[i].ToString("x"));
            }
            return sBuilder.ToString(); 
        }

  

posted @ 2011-08-07 21:46  OYJJ  阅读(326)  评论(0编辑  收藏  举报