Solved [solved] sha256 command options

Hi,

I haven't been able to google the answer to a question I've got. Can anyone help me understand the differences in output of the following commands?

Code:
23$ echo 12345 | openssl dgst -sha256
f33ae3bc9a22cd7564990a794789954409977013966fb1a8f43c35776b833a95
 24$ echo 12345 | sha256 -p           
12345
f33ae3bc9a22cd7564990a794789954409977013966fb1a8f43c35776b833a95
 25$ sha256 -s 12345
SHA256 ("12345") = 5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5

What causes the third command's hash output, 5994*cfc5, to differ from the first and second? Does either the "p" or "s" option add anything to the input?

Solved: It appears to be echo appending a new line. :r
 
Nice example of how one single character can change the outcome of a hash significantly ;)
 
Back
Top