Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize security module, remove _find_hashlib_algorithms. #1282

Merged
merged 3 commits into from Apr 21, 2018

Conversation

Projects
None yet
2 participants
@lepture
Copy link
Member

commented Apr 21, 2018

Cleanup the code via #1226 (comment)

Here is a breaking change _hash_internal, it once raised TypeError when hash func was invalid. However, the default behavior of hashlib.new or hmac.HMAC is raising ValueError. You can find the breaking change in test case.

hashfunc = hashlib.sha256
if not hashfunc:
hashfunc = 'sha256'

data = to_bytes(data)
salt = to_bytes(salt)

# If we're on Python with pbkdf2_hmac we can try to use it for
# compatible digests.
if _has_native_pbkdf2:

This comment has been minimized.

Copy link
@davidism

davidism Apr 21, 2018

Member

Fairly sure all supported Python's have native pbkdf2, and the if hash_name check below will always be True as written, so this entire function can be simplified.

This comment has been minimized.

Copy link
@davidism

davidism Apr 21, 2018

Member

Might have to look into this more. Under what circumstances is hashfunc callable but doesn't have a name?

This comment has been minimized.

Copy link
@lepture

lepture Apr 21, 2018

Author Member

Good to know. I've cleaned it up.

This comment has been minimized.

Copy link
@lepture

lepture Apr 21, 2018

Author Member

@davidism actually I don't know. I just copied it from the old code. I believe it will always has a name.

@davidism

This comment has been minimized.

Copy link
Member

commented Apr 21, 2018

Nice to remove all that code. 👍 Remember to add a changelog entry.

@lepture lepture merged commit 0751573 into master Apr 21, 2018

1 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@lepture lepture deleted the patch-security branch Apr 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.