delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/19/01:50:44

From: mcook AT cognex DOT com (Michael R Cook)
Subject: md5sum uses text mode, not binary mode
19 Jun 1998 01:50:44 -0700 :
Message-ID: <r4emwmb6ii.fsf.cygnus.gnu-win32@cognex.com>
To: gnu-win32 AT cygnus DOT com

The md5sum program seems to be reading it's files in text mode
instead of binary mode.  That seems to make md5sum mostly useless.

Here's what makes me think md5sum is using text mode.

First, md5sum calculates the same signature regardless of whether it
reads from stdin or whether it opens the file itself:

	$ md5sum foo.exe
	d4bb47940abe12e88cbf5286f3f0664b  foo.exe
	$ md5sum < foo.exe
	d4bb47940abe12e88cbf5286f3f0664b  -

Next, md5sum calculates the same signature even if its input came
from `cat'.

	$ cat foo.exe | md5sum
	d4bb47940abe12e88cbf5286f3f0664b  -

Finally, `cat' obviously uses text mode:

	$ cat foo.exe | wc
	     11      48    2098
	$ ls -l foo.exe
	-r-xr-xr-x   1 544      everyone  1190912 Jun 17 16:15 foo.exe
	$

Clearly, `cat' read only the first 2098 bytes.  I infer that it saw
a ^Z and stopped, implying that `cat' reads its files in text mode.

Michael.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019