Sometimes you have to implement C-Code and Encryption so I have a Problem with my C-Code implementation of hmac256 or sha2_hmac Implementation:
unsigned char key[19] = { "abcdef" };
size_t keylen = 18;
unsigned char input[64] = {"123456789"};
size_t ilen = 63;
unsigned char output[32];
int is224 = 0;
sha2_hmac(key, keylen, input, ilen, output, is224);
char result[64] = {};
char result2[64] = {};
for(int j = 0; j < 32; j++) {
sprintf(result, "%X", output[j]);
strcat(result2, result);
}
But the result is too short, when I compare it to the C# Code.
You have to adjust your
sprintf()function call like this: