MacOS – Openssl on mac -In is not working

macosopensslterminal

I am follow a tutorial guide from this link http://osxdaily.com/2012/01/30/encrypt-and-decrypt-files-with-openssl/

to try to produce -sha256 hash from an input file but when i type
openssl dgst -sha256 -in filename.txt

the command will return unknown option '-in'.

Can anyone please point out what have i gone wrong ?

OS Version: 10.11 OpenSSL Version: 1.0.2.d

Best Answer

I don't get any errors when I make a temporary file:

openssl version > /$TMPDIR/foo
openssl dgst -sha256 /$TMPDIR/foo

My version is OpenSSL 0.9.8zg 14 July 2015 and the sha256 of the resulting foo file is

SHA256(/tmp/foo)= 34ff579703733495dc5b883f288b71653653c8b449da860a1b6fb382fde1a5f1

Maybe you just need to remove the -in to calculate your digest?