Title: md5 digest incorrect compared to python
Type: behaviour Severity: normal
Components: Core Versions: 2.2.2
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, fwierzbicki, rcatherman
Priority: Keywords:

Created on 2008-03-06.12:17:07 by rcatherman, last changed 2008-03-07.14:34:44 by fwierzbicki.

msg3059 (view) Author: Ryan Catherman (rcatherman) Date: 2008-03-06.12:17:06
Use the folling command to md5sum a file:

$ java -Xmx256m -cp <path to jython>/jython.jar org.python.util.jython
-c "import md5;import sys;print open( sys.argv[1] ).read()
).hexdigest()" <file to hash>

Then, try the same thing with python:
$ python -c "import md5;import sys;print open( sys.argv[1]
).read() ).hexdigest()" <file to hash>
or with md5sum:
$ md5sum <file to hash>

The python and md5sum output match, while the jython does not.  I see
this behavior on 2.2.1, and 2.1.
msg3062 (view) Author: Charlie Groves (cgroves) Date: 2008-03-06.17:11:15
Haven't had a chance to look at this yet, but it's working on trunk and
broken on the Release_2_2maint branch.
msg3063 (view) Author: Ryan Catherman (rcatherman) Date: 2008-03-06.19:02:25
btw, the commands I pasted seem to work ok for small/text files and the
failure is with large/binary files.  Not sure if it's a size thing, or a
text vs binary thing.
msg3064 (view) Author: Ryan Catherman (rcatherman) Date: 2008-03-06.19:05:26
Crap, that's what it was.  Changing the pasted command to use open()
with 'b' it starts working.

You should close this bug.
msg3067 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2008-03-07.14:34:44
Ryan, thanks for the follow up analysis.  Closing.
Date User Action Args
2008-03-07 14:34:44fwierzbickisetstatus: open -> closed
resolution: invalid
messages: + msg3067
2008-03-06 19:05:26rcathermansetmessages: + msg3064
2008-03-06 19:02:26rcathermansetmessages: + msg3063
2008-03-06 18:52:36fwierzbickisetnosy: + fwierzbicki
2008-03-06 17:11:16cgrovessetnosy: + cgroves
messages: + msg3062
versions: + 2.2.2, - 2.2.1rc1
2008-03-06 12:17:07rcathermancreate