且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MD5加密

更新时间:2022-09-15 13:20:50

1MD5加密' ----------------------------------------------------
 2MD5加密        'The Encrypt method enables Encryt a clean string into hash
 3MD5加密        '
 4MD5加密        '加密字符串为hash
 5MD5加密        '
 6MD5加密        'SHA512Managed().ComputeHash(dataToHash)
 7MD5加密        'CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(data1ToHash)
 8MD5加密        '----------------------------------------------------
 9MD5加密        Public Shared Function Encrypt(ByVal cleanString As StringAs String
10MD5加密            '采用MD5
11MD5加密            Dim clearBytes As [Byte]()
12MD5加密            clearBytes = New UnicodeEncoding().GetBytes(cleanString)
13MD5加密            Dim hashedBytes As [Byte]() = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
14MD5加密            Dim hashedText As String = BitConverter.ToString(hashedBytes)
15MD5加密
16MD5加密            '再采用MD5
17MD5加密            clearBytes = New UnicodeEncoding().GetBytes(hashedText)
18MD5加密            hashedBytes = CType(CryptoConfig.CreateFromName("MD5"), HashAlgorithm).ComputeHash(clearBytes)
19MD5加密            hashedText = BitConverter.ToString(hashedBytes)
20MD5加密
21MD5加密            Return hashedText
22MD5加密        End Function
本文转自tiasys博客园博客,原文链接:http://www.cnblogs.com/tiasys/archive/2006/07/03/441833.html,如需转载请自行联系原作者