don't use hash_name but rather hash function directly#5
don't use hash_name but rather hash function directly#5prusnak wants to merge 1 commit intoTierion:masterfrom
Conversation
|
Hi @prusnak , Thanks for the PR. Comment: I think we could support both modes. Quickly passing a string makes the API easier to use and remember, while passing a function makes it generalize better. (Optional) |
|
Unfortunately, I don't have time to implement proposed changes at the time, but they should be pretty straightforward. Maybe someone else will pick this up. |
|
Thanks! Let me leave this open then. |
|
How about using it like this? Now you have no constraint on the hash function, and so long as your hash function is hashlib styled, it will work with no problem |
Python idiom is to use duck typing, so let's use it. Also it is possible to use hash functions that your library don't recognize, for example pyblake2.blake2s or pyblake2.blake2b (which use the same API as functions from hashlib)