1' ----------------------------------------------------
2 'The Encrypt method enables Encryt a clean string into hash
3 '
4 '加密字符串为hash
5 '
6 'SHA512Managed().ComputeHash(dataToHash)
7 'CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(data1ToHash)
8 '----------------------------------------------------
9 Public Shared Function Encrypt(ByVal cleanString As String) As String
10 '采用MD5
11 Dim clearBytes As [Byte]()
12 clearBytes = New UnicodeEncoding().GetBytes(cleanString)
13 Dim hashedBytes As [Byte]() = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
14 Dim hashedText As String = BitConverter.ToString(hashedBytes)
15
16 '再采用MD5
17 clearBytes = New UnicodeEncoding().GetBytes(hashedText)
18 hashedBytes = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
19 hashedText = BitConverter.ToString(hashedBytes)
20
21 Return hashedText
22 End Function
2 'The Encrypt method enables Encryt a clean string into hash
3 '
4 '加密字符串为hash
5 '
6 'SHA512Managed().ComputeHash(dataToHash)
7 'CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(data1ToHash)
8 '----------------------------------------------------
9 Public Shared Function Encrypt(ByVal cleanString As String) As String
10 '采用MD5
11 Dim clearBytes As [Byte]()
12 clearBytes = New UnicodeEncoding().GetBytes(cleanString)
13 Dim hashedBytes As [Byte]() = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
14 Dim hashedText As String = BitConverter.ToString(hashedBytes)
15
16 '再采用MD5
17 clearBytes = New UnicodeEncoding().GetBytes(hashedText)
18 hashedBytes = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
19 hashedText = BitConverter.ToString(hashedBytes)
20
21 Return hashedText
22 End Function