I am trying to obtain the md5 hash of a string. Said string consists of only uppercase and lowercase letters and digits. No other characters, including spaces and newlines. The string is inputted via a keyboard, rather than a file input, so there's no BOM or other flags present.
If I run locally using md5sum
I get the following output:
ubuntu@ubuntu:~$ echo word | md5sum
a46ec67a0f2e7c387926ac5d783ea4b8 -
ubuntu@ubuntu:~$ echo "word" | md5sum
a46ec67a0f2e7c387926ac5d783ea4b8 -
ubuntu@ubuntu:~$ echo "word" -n | md5sum
3a21ca21563e9535a9012daef61a0bdf -
I know the difference between the 2nd and 3rd outputs above is due to the absence of the newline character (. (Turns out it was not! See the accepted answer.)-n
). This part is clear to me
However, there are tools that give a third result. All non-CLI tools seems to give the same result, and that is what confuses me:
- http://www.miraclesalad.com/webtools/md5.php says it's
c47d187067c6cf953245f128b5fde62a
. - http://www.md5hashgenerator.com/ says it's
c47d187067c6cf953245f128b5fde62a
. - http://www.md5.cz/ says it's
c47d187067c6cf953245f128b5fde62a
. - http://www.md5online.org/md5-encrypt.html says it's
c47d187067c6cf953245f128b5fde62a
. - http://md5-hash-online.waraxe.us/ says it's
c47d187067c6cf953245f128b5fde62a
. - This Android app says it's
c47d187067c6cf953245f128b5fde62a
. echo -n "word" | unix2dos | md5sum
gives mec47d187067c6cf953245f128b5fde62a
.
What's going on here?