This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients Aur.Saraf, christian.heimes, gregory.p.smith, python-dev, tarek
Date 2022-03-16.11:49:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647431367.41.0.542638454506.issue45150@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-03-16 11:49:27christian.heimessetrecipients: + christian.heimes, gregory.p.smith, tarek, python-dev, Aur.Saraf
2022-03-16 11:49:27christian.heimessetmessageid: <1647431367.41.0.542638454506.issue45150@roundup.psfhosted.org>
2022-03-16 11:49:27christian.heimeslinkissue45150 messages
2022-03-16 11:49:27christian.heimescreate