HMAC SHA 256 decode/encode issues

Hey all I am trying to figure out why my HAC-SHA-256 encryption and decryption is not matching up from my Arduino code to my .net code:

C# code:

Dim message As String = "Hi There"
Dim expectedHex As String = ""

TextBox1.Text = (Convert.ToString("Ref : ") & expectedHex)

'Test out the HMAC hash method
Dim key As String = "61574d6b157f757d02457573556645750e0341481b127a07476303136c005145436c7b46651c6e4f4f040e1569464a794e534309097258550c17616075060950"
Dim hashHMACHex__1 As String = HashHMACHex(key, message)

TextBox2.Text = (Convert.ToString("HMAC: ") & hashHMACHex__1)

' Test out the SHA hash method
Dim innerKey As String = "61574d6b157f757d02457573556645750e0341481b127a07476303136c005145436c7b46651c6e4f4f040e1569464a794e534309097258550c17616075060950"
Dim outerKey As String = "0b3d27017f151f17682f1f193f0c2f1f64692b227178106d2d096979066a3b2f2906112c0f760425256e647f032c2013243929636318323f667d0b0a1f6c633a"
Dim hashSHAHex__2 As String = HashSHAHex(innerKey, outerKey, message)

TextBox3.Text=(Convert.ToString("SHA : ") & hashSHAHex__2)

Arduino code:

char *myData = "61574d6b157f757d02457573556645750e0341481b127a07476303136c005145436c7b46651c6e4f4f040e1569464a794e534309097258550c17616075060950#(128)";

void printHash(uint8_t* hash) {
  int i;
  for (i=0; i<32; i++) {
    Serial.print("0123456789abcdef"[hash[i]>>4]);
    Serial.print("0123456789abcdef"[hash[i]&0xf]);
  }
  Serial.println();
}

uint8_t* hash;
  uint32_t a;
  unsigned long ms;
  Serial.println("Test: RFC4231 4.2");
  Serial.println("");
  Serial.print("Result:");
  ms = micros();
  Sha256.initHmac((uint8_t *)myData,128);
  Sha256.print("Hi There");
  printHash(Sha256.resultHmac());
  Serial.print(" Hash took : ");
  Serial.print((micros() - ms));
  Serial.println(" micros");
  Serial.println();

The output from the .net program is this:

HMAC: 2d484b68dae3866fbcbf182071c3bf5e86f40ab6c2f3bc72d69fe0d132bf771e
SHA : 5929bc8b6968e763c7f23090f7d6194c4f1377bd8f6e4b781a5ecdb8e8f91f8f

And the Arduino output:

Result:9a9f6119b41604441db0a75bad6c4e1653a4d00781d4b177e99fe850ad543051

I’m not sure what innerKey and outterKey is in the .net program. That may be the cause of me not getting the correct values?

Attached is the full code for both the .net program and the arduino sketch.

sha256.zip (102 KB)