当前位置:首页 > 网络编程 > WEB编程 > ASP.net > DotNet中密码的加密(转)

DotNet中密码的加密(转)

点击次数:29 次 发布日期:2008-11-27 01:16:51 作者:源代码网
源代码网推荐 <%@ Import Namespace="System.Web.Security" %>
<html>
<head>
<script language="VB" runat=server>
" This function encrypts the input string using the SHA1 and MD5
" encryption algorithms
Sub encryptString(Src As Object, E As EventArgs)
   SHA1.Text = CookieAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "SHA1")
   MD5.Text = CookieAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5")
End Sub
</script>
</head>
<body>

<form runat=server>

<p><b>Original Clear Text Password: </b><br>
  <asp:Textbox id="txtPassword" runat=server />
  <asp:Button runat="server" text="Encrypt String" onClick="encryptString" /></p>

<p><b>Encrypted Password In SHA1: </b>
  <asp:label id="SHA1" runat=server /></p>

<p><b>Encrypted Password In MD5: </b>
  <asp:label id="MD5" runat=server /></p>

</form>

</body>
<



源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华