[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7739: bug in md5sum ?
From: |
Bob Proulx |
Subject: |
bug#7739: bug in md5sum ? |
Date: |
Sun, 26 Dec 2010 17:58:27 -0700 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Arnaud TARDY wrote:
> [...] but..md5sum are different between Linux and Windows for a same
> word!! Exemple
>
> Linux: echo 'somme' | md5sum
> result: cc72185f414a55738ee4460aa82802b3
Correct. Don't forget that echo adds a newline (\n) to the end of the
line.
$ echo 'somme' | md5sum
cc72185f414a55738ee4460aa82802b3 -
$ echo 'somme' | od -tx1 -c
0000000 73 6f 6d 6d 65 0a
s o m m e \n
0000006
> windows somme
> Result: 3CE6E7F240E6B94C36FD0DDA70C213E9
That would be the result of md5sum on that word without a newline on
the end. You can see this by using printf instead of echo. Printf
does not add a newline on the end of the line by default unless
directed by having a newline (\n) at the end of the string.
$ printf 'somme' | md5sum
3ce6e7f240e6b94c36fd0dda70c213e9 -
$ printf 'somme' | od -tx1 -c
0000000 73 6f 6d 6d 65
s o m m e
0000005
$ printf 'somme\n' | md5sum
cc72185f414a55738ee4460aa82802b3 -
$ printf 'somme\n' | od -tx1 -c
0000000 73 6f 6d 6d 65 0a
s o m m e \n
0000006
As such I don't think this is a bug but a misunderstanding of the
effects of the newline at the end of the line.
Bob