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

Use MD5 usedforsecurity=False on Python 3.9 and higher #2271

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Use MD5 usedforsecurity=False on Python 3.9 and higher #2271

merged 1 commit into from
Feb 14, 2024

Conversation

simonw
Copy link
Owner

@simonw simonw commented Feb 14, 2024

@simonw
Copy link
Owner Author

simonw commented Feb 14, 2024

I manually tested this fix in a FIPS Ubuntu Docker image using the steps outlined here and the tests passed too:

@simonw
Copy link
Owner Author

simonw commented Feb 14, 2024

Crucially the tests passed against Python 3.8, which demonstrates that this branch works:

def md5_not_usedforsecurity(s):
try:
return hashlib.md5(s.encode("utf8"), usedforsecurity=False).hexdigest()
except TypeError:
# For Python 3.8 which does not support usedforsecurity=False
return hashlib.md5(s.encode("utf8")).hexdigest()

@simonw simonw marked this pull request as ready for review February 14, 2024 02:23
@simonw simonw merged commit b89cac3 into main Feb 14, 2024
18 checks passed
@simonw simonw deleted the fips branch February 14, 2024 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant