加密求救.分20. 试试SHA1 sha1 = SHA1.Create(); 最后的结果= sha1.ComputeHash( Encoding.Unicode.GetBytes( xsc001 ) ); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试试SHA1 sha1 = SHA1.Create(); 最后的结果= sha1.ComputeHash( Encoding.Unicode.GetBytes( xsc001 ) );能给我个完整的代码吗? <%@ Page Language="C#" autoeventwireup="true" %><html> <head> <script runat="server"> void Cancel_Click(object sender, EventArgs e) { userName.Text = ""; password.Text = ""; repeatPassword.Text = ""; result.Text = ""; } void HashPassword_Click(object sender, EventArgs e) { if (Page.IsValid) { string hashMethod = ""; if (sha1.Checked) { hashMethod = "SHA1"; } else { hashMethod = "MD5"; } string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, hashMethod); result.Text="<credentials passwordFormat=\"" + hashMethod +"\"><br>" + " <user name=\"" + userName.Text + "\" password=\"" + hashedPassword + "\"><br>" + "</credentials>"; } else { result.Text = "There was an error on the page."; } } </script> </head> <body> <form runat="server"> <p>This form displays the results of the FormsAuthentication.HashPasswordForStoringInConfigFile method.<br>The user name and hashed password can be stored in a <credentials> node in the Web.config file.</p> <table> <tbody> <tr> <td>New User Name:</td> <td><asp:TextBox id="userName" runat="server"></asp:TextBox></td> <td><asp:RequiredFieldValidator id="userNameRequiredValidator" runat="server" ErrorMessage="User name required" ControlToValidate="userName"></asp:RequiredFieldValidator></td> </tr> <tr> <td>Password: </td> <td><asp:TextBox id="password" runat="server" TextMode="Password"></asp:TextBox></td> <td><asp:RequiredFieldValidator id="passwordRequiredValidator" runat="server" ErrorMessage="Password required" ControlToValidate="password"></asp:RequiredFieldValidator></td> </tr> <tr> <td>Repeat Password: </td> <td><asp:TextBox id="repeatPassword" runat="server" TextMode="Password"></asp:TextBox></td> <td><asp:CompareValidator id="passwordCompareValidator" runat="server" ErrorMessage="Password does not match" ControlToValidate="repeatPassword" ControlToCompare="password"></asp:CompareValidator></td> </tr> <tr> <td>Hash function: </td> <td align="middle"><asp:RadioButton id="sha1" runat="server" GroupName="HashType" Text="SHA1"></asp:RadioButton> <asp:RadioButton id="md5" runat="server" GroupName="HashType" Text="MD5"></asp:RadioButton></td> </tr> <tr> <td align="middle" colspan="2"> <asp:Button id="hashPassword" onclick="HashPassword_Click" runat="server" Text="Hash Password"> </asp:Button> <asp:Button id="cancel" onclick="Cancel_Click" runat="server" Text="Cancel" CausesValidation="false"> </asp:Button></td> </tr> </tbody> </table> <p><asp:Label id="result" runat="server"></asp:Label></p> </form> </body></html> sha1,md5加密我用了,xsc001加密后不是我想要的那个 c#,给按钮添加点击事件时,服务器端需要判断,怎么加载? Datalist页面数据绑定 .net 权限问题 请问在iis 6.0中可以在一个asp网站下挂一个asp.net网站,同时可以运行吗 关于GridView 更改选中记录 图片无刷新更新问题 求时间正则表达式 关于asp.net + IIS + 二级域名/三级域名 泛指向的问题!求救!在线急等~ 如何将DataTable中的一行,最简捷的转换成数组? datagrid中怎样单击或双击取出其某行某列的值 为什么在LinkButton中的CommandName只能用Edit?不是可以任意吗 加密(分不够可以再加)
SHA1 sha1 = SHA1.Create();
最后的结果= sha1.ComputeHash( Encoding.Unicode.GetBytes( xsc001 ) );
能给我个完整的代码吗?
<html>
<head>
<script runat="server">
void Cancel_Click(object sender, EventArgs e)
{
userName.Text = "";
password.Text = "";
repeatPassword.Text = "";
result.Text = "";
}
void HashPassword_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string hashMethod = "";
if (sha1.Checked)
{
hashMethod = "SHA1";
}
else
{
hashMethod = "MD5";
}
string hashedPassword =
FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, hashMethod);
result.Text="<credentials passwordFormat=\"" + hashMethod +"\"><br>" +
" <user name=\"" + userName.Text + "\" password=\"" +
hashedPassword + "\"><br>" + "</credentials>";
}
else
{
result.Text = "There was an error on the page.";
}
}
</script>
</head> <body>
<form runat="server">
<p>This form displays the results of the FormsAuthentication.HashPasswordForStoringInConfigFile
method.<br>The user name and hashed password can be stored in a <credentials> node
in the Web.config file.</p>
<table>
<tbody>
<tr>
<td>New User Name:</td>
<td><asp:TextBox id="userName" runat="server"></asp:TextBox></td>
<td><asp:RequiredFieldValidator id="userNameRequiredValidator" runat="server"
ErrorMessage="User name required" ControlToValidate="userName"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Password: </td>
<td><asp:TextBox id="password" runat="server" TextMode="Password"></asp:TextBox></td>
<td><asp:RequiredFieldValidator id="passwordRequiredValidator" runat="server"
ErrorMessage="Password required" ControlToValidate="password"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Repeat Password: </td>
<td><asp:TextBox id="repeatPassword" runat="server" TextMode="Password"></asp:TextBox></td>
<td><asp:CompareValidator id="passwordCompareValidator" runat="server"
ErrorMessage="Password does not match" ControlToValidate="repeatPassword"
ControlToCompare="password"></asp:CompareValidator></td>
</tr>
<tr>
<td>Hash function: </td>
<td align="middle"><asp:RadioButton id="sha1" runat="server" GroupName="HashType"
Text="SHA1"></asp:RadioButton>
<asp:RadioButton id="md5" runat="server" GroupName="HashType" Text="MD5"></asp:RadioButton></td>
</tr>
<tr>
<td align="middle" colspan="2">
<asp:Button id="hashPassword" onclick="HashPassword_Click" runat="server" Text="Hash Password">
</asp:Button>
<asp:Button id="cancel" onclick="Cancel_Click" runat="server" Text="Cancel" CausesValidation="false">
</asp:Button></td>
</tr>
</tbody>
</table>
<p><asp:Label id="result" runat="server"></asp:Label></p>
</form>
</body>
</html>