I have this code which generates an HMAC with a SHA384 hash. It uses openssl.
HMAC_CTX ctx;
HMAC_CTX_init(&ctx);
HMAC_Init_ex(&ctx, api_secret, (int)strlen(api_secret), EVP_sha384(), NULL);
HMAC_Update(&ctx, (unsigned char*)&encoded_payload, strlen(encoded_payload));
HMAC_Final(&ctx, result, &len);
HMAC_CTX_cleanup(&ctx);
for (int i = 0; i != len; i++)
printf("%02x", (unsigned int)result[i]);
So, as you can see, the hash is stored inside the result array. The printf loop is used to print each single unit in the array, converted to hexadecimal.
I need to store the printed hexadecimal string in a char variable. How can i do this? Thanks in advance!