asp.net md5加密

using System.Security.Cryptography;
using System.Text;

string MD5(string data)
        {
            // This is one implementation of the abstract class MD5.
            Encoding ecd = Encoding.UTF8;
            byte[] bs = ecd.GetBytes(data);
            MD5 md5 = new MD5CryptoServiceProvider();

            byte[] result = md5.ComputeHash(bs);

            return ecd.GetString(result);
        }

 

posted @ 2013-05-15 10:47  梦醒心晴  Views(151)  Comments(0Edit  收藏  举报