假设需要创建的字符串是abcde, 私有密钥:1d112dse1d2e,通过以下代码可以算出相应的值,。
Dim myEncoder As New System.Text.UTF8Encoding
Dim Key() As Byte = myEncoder.GetBytes("1d112dse1d2e")
Dim zifuchuan() As Byte = myEncoder.GetBytes("abcde")
Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(Key)
Dim HashCode As Byte() = myHMACSHA256.ComputeHash(zifuchuan)
Dim result As String = Convert.ToBase64String(HashCode)
MsgBox.Show(result)
[此贴子已经被作者于2018/8/29 23:52:16编辑过]