Red Hat Bugzilla – Bug 166245
Incorrect MD5 checksums from md5sum
Last modified: 2007-11-30 17:11:12 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc3 Firefox/1.0.6
Description of problem:
The md5sum utility generates incorrect MD5 checksums. For instance:
$ echo "abc" | md5sum
This value is inconsistent with both the RFC 1321 test suite (RFC 1321 pg. 21) and the output produced by the OpenSSL library, both of which generate a digest value of:
Downloading the tarball from GNU and exploring the source, the computation is done in lib/md5.c. In the current version (5.2.1), the output of md5_buffer() function is correct (matching the RFC), while the output of md5_stream(), the function called by the md5sum utility, is not.
I thought I would post this here while I try to find the problem in the source. It seems surprising that this hasn't been reported.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. As described above
echo appends a newline unless you use the -n parameter, this changes the
echo -n "abc" | md5sum
Yep! I also found that vim apparently appends a newlines at the end of the file,
even when no explicit RETURN is entered, so that explains the original
file-based problem as well. Sorry about that!