Public Sub HMACSHA256(key As String, input As String, key_is_hex_string As Boolean) As String
Private wrk_mac As Mac
Private wrk_key As KeyGenerator
Private wrk_bc As ByteConverter
Private wrk_byte() As Byte
wrk_key.Initialize("HMACSHA256")
If key_is_hex_string Then
wrk_key.KeyFromBytes(wrk_bc.HexToBytes(key))
Else
wrk_key.KeyFromBytes(key.GetBytes("UTF8"))
End If
wrk_mac.Initialise("HMACSHA256", wrk_key.Key)
wrk_mac.Update(input.GetBytes("UTF8"))
wrk_byte = wrk_mac.Sign
Return wrk_bc.HexFromBytes(wrk_byte).ToLowerCase
End Sub