Message415336
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. |
|
Date |
User |
Action |
Args |
2022-03-16 11:49:27 | christian.heimes | set | recipients:
+ christian.heimes, gregory.p.smith, tarek, python-dev, Aur.Saraf |
2022-03-16 11:49:27 | christian.heimes | set | messageid: <1647431367.41.0.542638454506.issue45150@roundup.psfhosted.org> |
2022-03-16 11:49:27 | christian.heimes | link | issue45150 messages |
2022-03-16 11:49:27 | christian.heimes | create | |
|