Merge pull request #29608 from martinky24/bugfix/29603/md5-fips · matplotlib/matplotlib@2d5e503 · GitHub
Skip to content

Commit 2d5e503

Browse files
authored
Merge pull request #29608 from martinky24/bugfix/29603/md5-fips
Remove md5 usage to prevent issues on FIPS enabled systems (closes #29603)
2 parents 8465b0f + 938ad62 commit 2d5e503

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

lib/matplotlib/sphinxext/mathmpl.py

Lines changed: 4 additions & 1 deletion

lib/matplotlib/testing/compare.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,20 @@ def get_cache_dir():
4646

4747

4848
def get_file_hash(path, block_size=2 ** 20):
49-
md5 = hashlib.md5()
49+
sha256 = hashlib.sha256(usedforsecurity=False)
5050
with open(path, 'rb') as fd:
5151
while True:
5252
data = fd.read(block_size)
5353
if not data:
5454
break
55-
md5.update(data)
55+
sha256.update(data)
5656

5757
if Path(path).suffix == '.pdf':
58-
md5.update(str(mpl._get_executable_info("gs").version)
59-
.encode('utf-8'))
58+
sha256.update(str(mpl._get_executable_info("gs").version).encode('utf-8'))
6059
elif Path(path).suffix == '.svg':
61-
md5.update(str(mpl._get_executable_info("inkscape").version)
62-
.encode('utf-8'))
60+
sha256.update(str(mpl._get_executable_info("inkscape").version).encode('utf-8'))
6361

64-
return md5.hexdigest()
62+
return sha256.hexdigest()
6563

6664

6765
class _ConverterError(Exception):

lib/matplotlib/texmanager.py

Lines changed: 4 additions & 1 deletion

0 commit comments

Comments
 (0)