码迷,mamicode.com
首页 > 其他好文 > 详细

md5加密

时间:2015-02-09 17:55:56      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:

先引用两个命名空间

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

以下是md5加密方法

/// <summary>
        /// md5加密--32位
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string md5jiami(string text)
        {
            byte[] result = Encoding.Default.GetBytes(text);
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            string s = BitConverter.ToString(output).Replace("-", "");
            return s;
        }

 

md5加密

标签:

原文地址:http://www.cnblogs.com/shensigzs/p/4281901.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!