Skip to content

Commit

Permalink
Merge pull request #324 from rstudio/mm-fips-md5
Browse files Browse the repository at this point in the history
Enable md5 in FIPS mode
  • Loading branch information
mmarchetti authored May 5, 2022
2 parents ca25985 + b52b741 commit 55d7fa5
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 55d7fa5

Please sign in to comment.