I want to get hash of a binary file whose name I have. I have tried the following, but then realized that SHA1() is returning hash value for the string ( name o
SHA1()
I don't know how your SHA1() function works (is it from libssl?), but I assume that by
SHA1((unsigned char *)fileName, strlen(fileName),hash);
you are hashing file name, so /bin/ls string. You need to read file content byte by byte into a buffer and hash it.
/bin/ls