1 Imports System. Security. Cryptography
2 Imports System. Text
3 Imports System. Text. regularexpressions
4 Public Class Security Class Security
5
6 ' **************************************** *****************************
7 '
8 ' Security. Encrypt () method
9 '
10 ' The encrypt method encryts a clean string into a hashed string
11
12 '
13 ' **************************************** *****************************
14 Public Shared Function encrypt () Function Encrypt ( Byval Cleanstring As String ) As String
15 Dim Clearbytes As [ Byte ] ()
16 Clearbytes = New Unicodeencoding (). getbytes (cleanstring)
17 Dim Hashedbytes As [ Byte ] () = Ctype (Cryptoconfig. createfromname ( " MD5 " ), Hashalgorithm). computehash (clearbytes)
18 Dim Hashedtext As String = Bitconverter. tostring (hashedbytes)
19 Return Hashedtext
20 End Function
21
22 End Class
23
You only need to use txtpassword. text on the page as the parameter of this function. It is a convenient encryption method. After encryption, you can check the database. All of them are in hexadecimal format.