您的位置:首页 > 编程语言 > ASP

[ASP.NET2.0]Common层通用代码之MD5

2007-05-17 12:14 351 查看

using System;


using System.Collections.Generic;


using System.Text;


using System.Security;


using System.Security.Principal;


using System.Security.Cryptography;




namespace Common




...{


public class MD5




...{


public static string Encrypt(string password)




...{




/**////获取Byte数组


Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);




/**////获取Hash值


Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);






/**////获取加密后的信息


return BitConverter.ToString(hashedBytes);


}


}


}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: