I would like to print the following hashed data. How should I do it?
unsigned char hashedChars[32];
SHA256((const unsigned char*)data.c_str(),
data.length(),
hashedChars);
printf("hashedChars: %X\n", hashedChars); // doesn't seem to work??
The hex format specifier is expecting a single integer value but you're providing instead an array of
char
. What you need to do is print out thechar
values individually as hex values.Since you are using C++ though you should consider using
cout
instead ofprintf
(it's more idiomatic for C++.