Skip to content

Commit

Permalink
Fix md5_hexdigest wrapper on FIPS enabled systems (#1410)
Browse files Browse the repository at this point in the history
* Fix md5_hexdigest wrapper on FIPS enabled systems

* Update _compat.py

* lint
  • Loading branch information
adriangb authored Jan 14, 2022
1 parent aa20cda commit 7d79ad9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion starlette/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# See issue: https://github.com/encode/starlette/issues/1365
try:

hashlib.md5(b"data", usedforsecurity=True) # type: ignore[call-arg]
# check if the Python version supports the parameter
# using usedforsecurity=False to avoid an exception on FIPS systems
# that reject usedforsecurity=True
hashlib.md5(b"data", usedforsecurity=False) # type: ignore[call-arg]

def md5_hexdigest(
data: bytes, *, usedforsecurity: bool = True
Expand Down

0 comments on commit 7d79ad9

Please sign in to comment.