Re: Bug in md5sum ?
Jim Meyering <[email protected]> Sat, 30 Nov 2002 12:17:52 +0100
| Newsgroups | gmane.comp.gnu.textutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
"Fabiani, Martin" <[email protected]> wrote: > we have tested md5sum and found that it doesn't calculate the results of the > testcases in RFC1321 (see > http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1321.html ). The same problem > appears to md5. The only solution we've found working correctly is the > Perl-Module Digest::MD5... > > These errors appear under Win2k and different versions of Solaris. > > --- extract from RFC1321 --- > > MD5 ("") = d41d8cd98f00b204e9800998ecf8427e ... > But the results under Win2k pro are: > > C:\work\perl\basics\md5>echo "" | md5sum > 2f8f3230bbc42e379a1554ca3419d46d *- ... Thanks for the report, but the problem is in your tests. `echo ""' (which is the same as `echo') outputs a single newline character. Note that those test inputs contain no newline bytes. So if you want to do tests on the command line, I suggest that you use printf -- or find a version of echo that supports the `-n' option. printf '' | /dev/null printf a | md5sum BTW, if you get the latest package (note that it's now called coreutils) ftp://alpha.gnu.org/gnu/fetish/coreutils-4.5.3.tar.gz and build (e.g., on solaris), then type `make check', that will run tests, including those from RFC1321, of most tools that are built.