首页 > 编程 > .NET > 正文

DotNet中密码的加密(转)

2024-07-21 02:20:18
字体:
来源:转载
供稿:网友
<%@ 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>
</html>
  • 本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。
  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表