Skip to content

Commit

Permalink
pass usedforsecurity=False to md5
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchetti committed Apr 8, 2022
1 parent ca25985 commit b52b741
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rsconnect_jupyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ def md5(s):
if hasattr(s, "encode"):
s = s.encode("utf-8")

h = hashlib.md5()
try:
h = hashlib.md5()
except Exception:
# md5 is not available in FIPS mode, see if the usedforsecurity option is available
# (it was added in python 3.9). We set usedforsecurity=False since we are only
# using this for a file upload integrity check.
h = hashlib.md5(usedforsecurity=False)

h.update(s)
return h.hexdigest()

Expand Down

0 comments on commit b52b741

Please sign in to comment.