diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..e137fadb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/src/webassets/utils.py b/src/webassets/utils.py index 985f5cec..4d53b829 100644 --- a/src/webassets/utils.py +++ b/src/webassets/utils.py @@ -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