1.引入名字空间
using System.Web.Security;
2.定义要加密的字符串
string beforeEncrypt,afterEncrypt;
3.开始加密(MD5)
afterEncrypt==FormsAuthentication.HashPasswordForStoringInConfigFile(beforeEncrypt,,"md5");
4.使用sha1加密(sha1)
afterEncrypt==FormsAuthentication.HashPasswordForStoringInConfigFile(beforeEncrypt,"sha1");
5.加密字符串的长度
sha1加密后的字符串长度为40,MD5加密后的字符串长度为:32