Antonio Valentino added the comment:

Hi all,
please note that to stay compatible with the GNU md5sum utility you should 
print the file name prefixed by a "*" if you read the file in binary mode.

Also when digests is checked, files to check should be opened in binary or text 
mode according the presence/absence of the "*" character before the file name.

A explicit error should be raised IMO if some specific mode is not supported 
(e.g. text mode) by the check function.

Also, since the tool supports different hashing algorithms the 
openssl/BSD-style output format could be more appropriate IMO:

MD5 (file01.dat) = 101b455ce70d2e73e1a4d92a3e8c29e1

FYI I wrote a the hashsum package [1] that provides a command line tool that is 
intended to be a "Python drop-in replacement for md5sum and co.".

If my understanding is correct you want to keep this patch as simple as 
possible but, if you are interested in, I could provide patches to:

* fix the GNU style output: binary ("*") vs text mode
* implement full support for the text mode
* implement full support for BSD-style output format

I could also convert the hassum.py utility [1] to be integrated directly in 
hashlib.

[1] https://github.com/avalentino/hashsum

----------
nosy: +avalentino

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26488>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to