I'm trying to produce a "Signature" SHA1 string to append to a URI.
I've got a string URI piece and a secret from the target vendor. I need to take the URI text and the secret and produce a signature string that looks similar to this in formatting: "4623B7B8-18A6-4B2C-B2C1-18157F5C4AFE"
Imports System.Security.Cryptography
'This is the String to use to create the SHA1
Dim DataToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(TextBox1.Text)
'This is the secret key given to me from the vendor
Dim SecretKey() As Byte = System.Text.Encoding.ASCII.GetBytes(TextBox2.Text)
Using myhmac As New HMACSHA1(SecretKey)
Using MS As New IO.MemoryStream(DataToHash)
Dim HashValue As Byte() = myhmac.ComputeHash(MS)
'This is the output or signature
TextBox3.Text = System.Text.Encoding.Unicode.GetString(HashValue)
End Using
End Using
I've got this code from someone but the output testbox3.text looks like Chinese.
What am I missing?