Bug 166245

Summary: Incorrect MD5 checksums from md5sum
Product: [Fedora] Fedora Reporter: Tim <ack210t>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-08-18 05:46:02 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Tim 2005-08-18 05:12:26 EDT
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
0bee89b07a248e27c83fc3d5951213c1  -

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):

How reproducible:

Steps to Reproduce:
1. As described above

Additional info:
Comment 1 Karsten Hopp 2005-08-18 05:46:02 EDT
echo appends a newline unless you use the -n parameter, this changes the   
   echo -n  "abc" | md5sum  
Comment 2 Tim 2005-08-18 06:07:30 EDT
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!