The most common Encryption Class

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.