Dear there,
I am testing a snippet to compute hash of file using openssl.
My snippet below:
#include <openssl/sha.h>
#include <stdio.h>
int main()
{
const unsigned char str[] = "Original String";
unsigned char hash[SHA_DIGEST_LENGTH]; // == 20
SHA1(str, sizeof(str)-1, hash);
// puts(hash);
return 0;
}
I added lib of openssl but when compiling I got this message in build log.
-------------- Clean: Debug in ComputeHash (compiler: GNU GCC Compiler)---------------
Cleaned "ComputeHash - Debug"
-------------- Build: Debug in ComputeHash (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -g -IC:\Users\%username%\Documents\CodeBlock\ComputeHash\ -c C:\Users\%username%\Documents\CodeBlock\ComputeHash\HashComputing.cpp -o obj\Debug\HashComputing.o
g++.exe -o bin\Debug\ComputeHash.exe obj\Debug\HashComputing.o -static lib\libcrypto.lib
lib\libcrypto.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I use Code::Blocks 17.12 recv 11256. Openssl 1.1.1b
How can I fix this? Any idea?
Thanks!