Skip to content

Commit 3b98bd8

Browse files
authored
Merge pull request #177 from jandrej/md5-fips
Add usedforsecurity flag to md5 hashing
2 parents c0e399b + 7ad5e62 commit 3b98bd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fortls/parse_fortran.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,14 @@ def load_from_disk(self) -> tuple[str | None, bool | None]:
872872
return "Could not read/decode file", None
873873
else:
874874
# Check if files are the same
875-
hash = hashlib.md5(contents.encode("utf-8")).hexdigest()
875+
try:
876+
hash = hashlib.md5(
877+
contents.encode("utf-8"), usedforsecurity=False
878+
).hexdigest()
879+
# Python <=3.8 does not have the `usedforsecurity` option
880+
except TypeError:
881+
hash = hashlib.md5(contents.encode("utf-8")).hexdigest()
882+
876883
if hash == self.hash:
877884
return None, False
878885

0 commit comments

Comments
 (0)