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

Before we continue hacking on an implementation, let's discuss some API design.

- Multiple functions or multiple dispatch (name, fileobj) are confusing to 
users. Let's keep it simple and only implement one function that operates on 
file objects.

- The function should work with most binary file-like including open(..., 
"rb"), BytesIO, SocketIO. mmap.mmap() is not file-like enough. Anon mapping 
doesn't provide a fileno and the mmap object has no readinto().

- The function should accept either digest name, digest constructor, or a 
callable that returns a digest object. The latter makes it possible to reuse 
file_digest() with MAC constructs like HMAC.

- Don't do any I/O in C unless you are prepared to enter a world of pain and 
suffering. It's hard to get it right across platforms. For example your C code 
does not work for SocketIO on Windows.

- If we decide to implement an accelerator in C, then we don't have to bother 
with our fallback copies like _sha256module.c. They are slow and only used when 
OpenSSL is not available.

----------
assignee: tarek -> christian.heimes

_______________________________________
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