[issue45150] Add a file_digest() function in hashlib

2022-03-16 Thread Aur Saraf
Aur Saraf added the comment: I don't think HMAC of a file is a common enough use case to support, but I have absolutely no problem conceding this point, the cost of supporting it is very low. I/O in C is a world of pain in general. In the specific case of `io.RawIOBase` objects

[issue45150] Add a file_digest() function in hashlib

2022-03-15 Thread Aur Saraf
Aur Saraf added the comment: Added an attempt to handle signals. I don't think it's working, because when I press Ctrl+C while hashing a long file, it only raises KeyboardInterrupt after waiting the amount of time it usually takes the C code to return, but maybe that's

[issue45150] Add a file_digest() function in hashlib

2022-03-15 Thread Aur Saraf
Aur Saraf added the comment: Forgot an important warning: this is the first time I write C code against the Python API, and I didn't thoroughly read the guide (or at all, to be honest). I think I did a good job, but please suspect my code of noob errors. I'm especially not conf

[issue45150] Add a file_digest() function in hashlib

2022-03-15 Thread Aur Saraf
Aur Saraf added the comment: The rationale behind `from_raw_file()` and the special treatment of non-buffered IO is that there is no `read_buffer()` API or other clean way to say "I want to read just what's currently in the buffer so that from now on I could read directly fro

[issue45150] Add a file_digest() function in hashlib

2022-03-15 Thread Aur Saraf
Aur Saraf added the comment: PR contains a draft implementation, would appreciate some review before I implement the same interface on all builtin hashes as well as OpenSSL hashes. -- ___ Python tracker <https://bugs.python.org/issue45

[issue45150] Add a file_digest() function in hashlib

2022-03-14 Thread Aur Saraf
Aur Saraf added the comment: OK, I'll give it a go. -- ___ Python tracker <https://bugs.python.org/issue45150> ___ ___ Python-bugs-list mailing list

[issue45150] Add a file_digest() function in hashlib

2022-03-14 Thread Aur Saraf
Aur Saraf added the comment: Tarek, Are you still working on this? Would you like me to take over? Aur -- nosy: +Aur.Saraf ___ Python tracker <https://bugs.python.org/issue45