Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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"?

share|improve this question
2  
Does your file include a new line or not? –  cmouse Nov 11 '11 at 8:50

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.