From e53a6bc81856c7e918f683f40c31239ea93f1dca Mon Sep 17 00:00:00 2001 From: Tomas Jelinek Date: Thu, 3 Mar 2022 14:27:09 +0100 Subject: [PATCH] replace md5 with sha256 MD5 is unavailable on systems with active FIPS mode. That makes black crash when run on such systems. --- src/black/mode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/black/mode.py b/src/black/mode.py index 6d45e3dc4da..455ed36e27e 100644 --- a/src/black/mode.py +++ b/src/black/mode.py @@ -4,7 +4,7 @@ chosen by the user. """ -from hashlib import md5 +from hashlib import sha256 import sys from dataclasses import dataclass, field @@ -182,6 +182,6 @@ def get_cache_key(self) -> str: str(int(self.magic_trailing_comma)), str(int(self.experimental_string_processing)), str(int(self.preview)), - md5((",".join(sorted(self.python_cell_magics))).encode()).hexdigest(), + sha256((",".join(sorted(self.python_cell_magics))).encode()).hexdigest(), ] return ".".join(parts)