hashlib: import pure python hash first to unbreak the hmac module #435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the current import strategy that favours the uhashlib
implementation before using the "internal" hashlib version external
modules like "hmac" break because the uhashlib versions lack properties
like
{digest,block}_size, copy()
.This commit changes the import so that the internal version of the
hash is tried to be imported first and only if there is no internal
version then the uhashlib version is used.
This should fix #384
I guess as an alternative we could try to make uhashlib compatible with hmac.
This should be relatively straightforward and was done in micropython/micropython#4539 but wasn't received favorable there.