I have this function which prints the hmac of a string:
char *print_bits(unsigned char *bits, size_t len)
{
int i;
char buf[64], *put = buf;
for(i = 0; i < len; i++){
put += snprintf(put, 64, "%02x", bits[i]);
}
return put;
}
I want to use the result of printf and it send to my client app:
char buffer[64]
len = strlen(buffer);
if(len < BUFFERSIZE)
{
gen_hmac_sha256(global_eid, (unsigned char *) buffer, len + 1);
get_hmac_sha256(global_eid, hmac_sha256_out, HMAC_SHA256_LEN);
printf("App.cpp: hmac sha256 hash: ");
char *buffer2 = print_bits(hmac_sha256_out, 32);
printf("\n");
send(new_sock, buffer2, 64, 0);
}
However, send is not sending the result to the client. Thanks in advance for your help.