在ASP.NET中提供System.Web.Security命名空间,可以轻松实现SHA1和MD5加密,代码如下: using System.Web.SessionState; Response.Write(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("", "SHA1")); Response.Write("
" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("", "MD5"));
" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("", "MD5"));