以上是VB.NET的SHA1哈希函數。Visual Basic中SHA-1哈希函數的語法解釋
Function getSHA1Hash(ByVal strToHash As String) As String
Dim sha1Obj As New Security.Cryptography.SHA1CryptoServiceProvider
Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
bytesToHash = sha1Obj.ComputeHash(bytesToHash)
Dim strResult As String = ""
For Each b As Byte In bytesToHash
strResult += b.ToString("x2")
Next
Return strResult
End Function
請可能有人解釋上述(Visual Basic.net中)的代碼,具體地低於線 -
bytesToHash = sha1Obj.ComputeHash(bytesToHash)
For Each b As Byte In bytesToHash
strResult += b.ToString("x2")