📄 hash.aspx
字号:
<%@ Import Namespace="System.Security.Cryptography" %>
<Script Runat="Server">
Function Convert2ByteArray( strInput As String ) As Byte()
Dim intCounter As Integer
Dim arrChar As Char()
arrChar = strInput.ToCharArray()
Dim arrByte( arrChar.Length - 1 ) As Byte
For intCounter = 0 To arrByte.Length - 1
arrByte( intCounter ) = Convert.ToByte( arrChar( intCounter ) )
Next
Return arrByte
End Function
Sub Button_Click( s AS Object, e As EventArgs )
Dim arrHashInput As Byte()
Dim arrHashOutput As Byte()
Dim objMD5 As MD5CryptoServiceProvider
objMD5 = New MD5CryptoServiceProvider
arrHashInput = Convert2ByteArray( txtInput.Text )
arrHashOutput = objMD5.ComputeHash( arrHashInput )
lblOutput.Text = BitConverter.ToString( arrHashOutput )
End Sub
</Script>
<html>
<head><title>Hash.aspx</title></head>
<body>
<form Runat="Server">
<h2>Generate MD5 Hash</h2>
<b>Enter text to hash:</b>
<br>
<asp:TextBox
id="txtInput"
TextMode="Multiline"
Columns="50"
Rows="10"
Runat="Server" />
<p>
<asp:Button
Text="Compute Hash!"
OnClick="Button_Click"
Runat="Server" />
<p>
<b>Hash value:</b>
<br>
<asp:Label
ID="lblOutput"
Runat="Server" />
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -