Public Function MYSQL5(ByVal Text As String) As String If Not String.IsNullOrEmpty(Text) Then ' Setup a SHA1 Crypto Provider Dim sha1crypto As New System.Security.Cryptography.SHA1CryptoServiceProvider Dim encoding As New System.Text.UTF8Encoding() Try ' Get the bytes of our string and comput the hash, twice! Dim byteHash() As Byte = sha1crypto.ComputeHash(encoding.GetBytes(Text)) byteHash = sha1crypto.ComputeHash(byteHash) ' Spit out the hash appended with the asterisk Return "*" & BitConverter.ToString(byteHash).Replace("-", "") Catch e As System.Text.EncoderFallbackException Return "" End Try End If Return "" End Function
Posted: March 20, 2023
Return to the snippets listing