Christian Heimes <li...@cheimes.de> added the comment:

Hey Tarek, long time no see!

* the _sha256 module is optional, can be disabled and is not available in some 
distributions.

* I also don't like to use sha256 has default. It's slow, even slower than 
sha512. Any default makes it also harder to upgrade to a better, more secure 
default in the future.

* like hmac.new() a file_digest() should accept PEP 452-compatible arguments 
and hash name as digstmod argument, not just a callable.

* a filename argument prevents users from passing in file-like objects like 
BytesIO.

* 4096 bytes chunk size is very conservative. The call overhead for read() and 
update() may dominate the performance of the function.

* The hex argument feels weird.

In a perfect world, the hash and hmac objects should get an "update_file" 
method. The OpenSSL-based hashes could even release the GIL and utilize 
OpenSSL's BIO layer to avoid any Python overhead.

----------

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

Reply via email to