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

Support use on systems enforcing FIPS compliance. #549

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
10 changes: 9 additions & 1 deletion src/webassets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@

if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.md5
try:
from functools import partial
# Include the usedforsecurity parameter so the call will
# succeed on systems that enforce compliance with the
# Federal Information Processing Standard (FIPS) and thus
# don't allow md5 for encryption.
md5_constructor = partial(hashlib.md5,usedforsecurity=False)
except (ImportError,TypeError):
md5_constructor = hashlib.md5
else:
import md5
md5_constructor = md5.new
Expand Down