MD5Sum seriously broken in b19.1? (generates incorrect md5 hash values)

Andrew Dalgleish andrewd@axonet.com.au
Fri Sep 4 05:17:00 GMT 1998


Quick work-around - use a "text=binary" mount.

I get the same correct answer on a "text=binary" mount, and the same
incorrect result on a "text!=binary" mount.
The files are identical up to the first ^Z, hence they give the same
hash.

I've checked the source and md5sum is broken.

Here's a patch to textutils-1.22

----- cut here -----
--- src/md5sum.c.old    Tue Dec 24 09:57:31 1996
+++ src/md5sum.c        Thu Sep 03 11:28:54 1998
@@ -35,7 +35,12 @@
 /* Most systems do not distinguish between external and internal
    text representations.  */
 #if UNIX || __UNIX__ || unix || __unix__ || _POSIX_VERSION
-# define OPENOPTS(BINARY) "r"
+# ifdef STDC_HEADERS
+/* But that's no excuse for bad code. We will pass in the text/binary
option even if it gets ignored. */
+#   define OPENOPTS(BINARY) ((BINARY) != 0 ? "rb" : "r")
+# else
+#   define OPENOPTS(BINARY) "r"
+# endif
 #else
 # ifdef MSDOS
 #  define TEXT1TO1 "rb"
----- cut here -----

Regards,
Andrew Dalgleish


> -----Original Message-----
> From:	Ralf G. R. Bergs [SMTP:rabe@RWTH-Aachen.DE]
> Sent:	1998 September 02, Wednesday 09:30
> To:	gnu-win32@cygnus.com
> Subject:	MD5Sum seriously broken in b19.1? (generates incorrect
> md5 hash values)
> 
> Hi there,
> 
> I'm running NT 4.0 SP3, and I have some strange problems with md5sum.
> 
> From a crypto class I know that it's practically impossible for two
> files to 
> share the same MD5 hash, BUT I have lots of files with the same md5
> sum. How 
> come???
> 
> I'm attaching two picture files (of a well-known lady named Pam
> Anderson ;-) 
> that produce the same md5 sum under NT:
> 
> [m:\new\pix\pam anderson]md5sum -b pam1.jpg pam2.jpg
> fefe0c8ca9ff2a739ef0e0910c135a1d *pam1.jpg
> fefe0c8ca9ff2a739ef0e0910c135a1d *pam2.jpg
> 
> Under Linux I get different MD5 values:
> 
> Server:~$ md5sum -b pam1.jpg pam2.jpg 
> d7d4d61579d749152a7903399f977dd1 *pam1.jpg
> 077362ac4360e94ad9e15cd622d84d7a *pam2.jpg
> 
> Note that I DID use "-b" for binary mode!
> 
> What's going on here? Could you *please* investigate this, since I
> need a 
> solution ASAP.
> 
> Thanks very much for your time,
> 
>   Ralf
> 
> 
> -- 
> Ralf G. R. Bergs * Welkenrather Str. 100/102 * 52074 Aachen * Germany
> +49-241-876892, +49-241-877776 (fax) * rabe@rwth-aachen.de  * PGP ok!
>  << File: pam1.jpg >>  << File: pam2.jpg >> 
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list