I created a file and input some random string into it.
touch tesseract && echo 'TestTestTestTestTest' > tesseract
Now if I use openssl to compute base64 hash [sha256], I run this:
cat tesseract | openssl dgst -sha256 | openssl base64 -A
which returns me
KHN0ZGluKT0gMzJjYjA1MTgzNDNhZmY2N2FlMmY5YzUwNDcwNGRiNGE5Njc5MzIyZWVlNTBmMjBiNTMzNjZlYTBiMDY2MWNlZgo=
Now I process this hash stepwise, as,
cat tesseract | openssl dgst -sha256 > partialHash
which gives me
(stdin)= 32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef
Let this hash be X.
Then I do this,
echo '32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef' > partialHash
cat partialHash | openssl base64 -A
I get a different result. Why is that?
My reason for asking is because I use a binary, hashdeep which gives me hashes in form of 32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef and I wish to convert them to base64 encoded format as hashdeep is not capable of producing a base64 output. So I pipe the intermediate hash to openssl base64 -A, but obtain a different result.
What am I missing? How can I convert the non-encoded hash X [which is 32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef] to proper base64 encoded format?
For simplicity purpose, we can assume that X is present in a file,
created using echo '32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef' > file