如何在C中复制SHA512哈希

我有以下代码来计算sha512哈希:

#include  #include  #include  int main() { char *password = "test"; char hash[SHA512_DIGEST_LENGTH]; SHA512(password, strlen(password), hash); return 0; } 

如何以hex打印出计算出的哈希值?

谢谢

hash更改为unsigned char hash[SHA512_DIGEST_LENGTH] 。 然后:

 for(int i = 0; i < SHA512_DIGEST_LENGTH; ++i) { printf("%02x", hash[i]); }