GNU bug report logs -
#17997
md5sum adds a new line at the end of the input
Previous Next
Reported by: xavier.richez <at> laposte.net
Date: Fri, 11 Jul 2014 15:39:01 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17997 in the body.
You can then email your comments to 17997 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#17997
; Package
coreutils
.
(Fri, 11 Jul 2014 15:39:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
xavier.richez <at> laposte.net
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 11 Jul 2014 15:39:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
I implemented my own MD5 generator.
It provides the same results as all the online MD5 generators, like for instance http://onlinemd5.com/.
But it gives a different result than the GNU md5sum tool.
So I investigated this : it seems that md5sum adds a newline at the end of the input !
That is quite easy to test :
- go to http://onlinemd5.com/, type "test" as text input. The MD5 sum is 098f6bcd4621d373cade4e832627b4f6
- now type in a prompt : "echo test | md5sum". The MD5 sum is d8e8fca2dc0f896fd7cb4cb0031ba249
- back to onlinemd5.com, type "test" and press enter to add a new line in the input. Now the MD5 sum is d8e8fca2dc0f896fd7cb4cb0031ba249 !!
This behaviour was detected on RedHat Enterprise Linux 6.3 with GNU Coreutils 8.4.
I was able to reproduce it using the latest 8.22 version (fresh build) on the same machine, and on CentOS 5.10 with Coreutils 5.97.
Did someone know about this ?
Best regards,
Xavier Richez.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#17997
; Package
coreutils
.
(Fri, 11 Jul 2014 15:46:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 17997 <at> debbugs.gnu.org (full text, mbox):
tag 17997 notabug
close 17997
stop
On 07/11/2014 09:48 AM, xavier.richez <at> laposte.net wrote:
> Hello,
>
> I implemented my own MD5 generator.
> It provides the same results as all the online MD5 generators, like for instance http://onlinemd5.com/.
>
> But it gives a different result than the GNU md5sum tool.
> So I investigated this : it seems that md5sum adds a newline at the end of the input !
>
> That is quite easy to test :
> - go to http://onlinemd5.com/, type "test" as text input. The MD5 sum is 098f6bcd4621d373cade4e832627b4f6
> - now type in a prompt : "echo test | md5sum". The MD5 sum is d8e8fca2dc0f896fd7cb4cb0031ba249
> - back to onlinemd5.com, type "test" and press enter to add a new line in the input. Now the MD5 sum is d8e8fca2dc0f896fd7cb4cb0031ba249 !!
>
> This behaviour was detected on RedHat Enterprise Linux 6.3 with GNU Coreutils 8.4.
> I was able to reproduce it using the latest 8.22 version (fresh build) on the same machine, and on CentOS 5.10 with Coreutils 5.97.
>
> Did someone know about this ?
echo adds the newline.
$ printf 'test' | md5sum
098f6bcd4621d373cade4e832627b4f6 -
thanks,
Pádraig.
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Jul 2014 15:46:03 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
17997 <at> debbugs.gnu.org and xavier.richez <at> laposte.net
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Jul 2014 15:46:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#17997
; Package
coreutils
.
(Fri, 11 Jul 2014 15:48:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 17997-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 17997 notabug
thanks
On 07/11/2014 02:48 AM, xavier.richez <at> laposte.net wrote:
> Hello,
>
> I implemented my own MD5 generator.
> It provides the same results as all the online MD5 generators, like for instance http://onlinemd5.com/.
>
> But it gives a different result than the GNU md5sum tool.
> So I investigated this : it seems that md5sum adds a newline at the end of the input !
No, YOU are adding a newline into the input you are feeding to md5sum.
>
> That is quite easy to test :
> - go to http://onlinemd5.com/, type "test" as text input. The MD5 sum is 098f6bcd4621d373cade4e832627b4f6
> - now type in a prompt : "echo test | md5sum". The MD5 sum is d8e8fca2dc0f896fd7cb4cb0031ba249
Try this:
echo test | od -tx1z
printf test | od -tx1z
Notice the difference? If you use echo, you are passing a newline into
md5sum, and md5sum is doing the right thing. Use printf instead of
echo, and you will get the results you want.
As this is a usage error and not a bug, I'm closing this report. But
feel free to ask further questions as needed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 09 Aug 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 311 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.