How to convert a raw 64-byte binary to Hex or ASCII in C
问题 I´m using SHA512 in C to get an Hash-Value. I did it like this: #include <stdlib.h> #include <stdio.h> #include <openssl/sha.h> int main(int argc, char *argv[]){ unsigned char hash[SHA512_DIGEST_LENGTH]; char data[] = "data to hash"; //Test Data SHA512(data, sizeof(data) - 1, hash); //Kill termination character //Now there is the 64byte binary in hash I tried to convert it to hex by: long int binaryval, hexadecimalval = 0, i = 1, remainder; binaryval=(long int)hash; while (binaryval != 0) {