I noticed, that when trying to generate some hashes after copy-pasting them into a file with vim, the hash is not as it is supposed to be. Same when file was opened and written out. Same behavior with nano, so there must be something I am mising.
$ echo -n "foo" | openssl dgst -sha256
2c26...e7ae
$ echo -n "foo" > hash.txt
$ openssl dgst -sha256 hash.txt
SHA256(hash.txt)= 2c26...e7ae
But when I open hash.txt with nano or vim and quit without inserting anything, I subsequently get the following hash: b5bb...944c
I also noticed that without opening the file and writing out I do not see the output when using cat
or head
. Was the encoding changed?