md5sum returns a different hash value than online hash generators
On suse10
md5sum myname
gives md5 hash as 49b0939cb2db9d21b038b7f7d453cd5d
.
The file myname contains string "ravi"
while some of the online md5 hash generators for the same string seem to give a different hash
http://md5-encryption.com/
http://www.miraclesalad.com/webtools/md5.php
They spit out the hash for "ravi" as 63dd3e154ca6d948fc380fa576343ba6
Why is there a difference in md5sum for the same string "ravi"?
Solution 1:
If you look at your file myname
, you will probably find that it contains extra characters e.g.
od -x myname
0000000 6172 6976 000a
0000005
Note the 000a
at the end of line 1. When you type ravi
into the online form you are not entering the 000a
as well so the md5sums are different.
You can see the effect of this like so
echo ravi | od -x
0000000 6172 6976 000a
echo ravi | md5sum
49b0939cb2db9d21b038b7f7d453cd5d -
The answers are the same as for you file.
echo -n ravi | od -x
0000000 6172 6976
echo -n ravi | md5sum
63dd3e154ca6d948fc380fa576343ba6 -
The results are the same as the online form.