MD5

using System.Security.Cryptography;
 
        /// <summary>
        /// MD5加密函数
         /// </summary>
        /// <param name="Srcstr"></param>
        /// <returns></returns>
        public string GetStrMD5Code(string Srcstr)
        {
            MD5CryptoServiceProvider md5csp = new MD5CryptoServiceProvider();
            byte[] SrcBytes = Encoding.Default.GetBytes(Srcstr);
            byte[] MD5Bytes = md5csp.ComputeHash(SrcBytes);

            string MD5Code = BitConverter.ToString(MD5Bytes);
            MD5Code = MD5Code.Replace("-","");
            return MD5Code;
        }

 

posted on 2012-06-15 14:30  史冰  阅读(223)  评论(0编辑  收藏  举报

导航