Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove md5 usage to prevent issues on FIPS enabled systems (closes #29603)#29608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:mainfrommartinky24:bugfix/29603/md5-fips
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletionlib/matplotlib/sphinxext/mathmpl.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,7 +146,10 @@ def latex2html(node, source):
fontset = node['fontset']
fontsize = node['fontsize']
name = 'math-{}'.format(
hashlib.md5(f'{latex}{fontset}{fontsize}'.encode()).hexdigest()[-10:])
hashlib.sha256(
f'{latex}{fontset}{fontsize}'.encode(),
usedforsecurity=False,
).hexdigest()[-10:])

destdir = Path(setup.app.builder.outdir, '_images', 'mathmpl')
destdir.mkdir(parents=True, exist_ok=True)
Expand Down
12 changes: 5 additions & 7 deletionslib/matplotlib/testing/compare.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,22 +46,20 @@ def get_cache_dir():


def get_file_hash(path, block_size=2 ** 20):
md5 = hashlib.md5()
sha256 = hashlib.sha256(usedforsecurity=False)
with open(path, 'rb') as fd:
while True:
data = fd.read(block_size)
if not data:
break
md5.update(data)
sha256.update(data)

if Path(path).suffix == '.pdf':
md5.update(str(mpl._get_executable_info("gs").version)
.encode('utf-8'))
sha256.update(str(mpl._get_executable_info("gs").version).encode('utf-8'))
elif Path(path).suffix == '.svg':
md5.update(str(mpl._get_executable_info("inkscape").version)
.encode('utf-8'))
sha256.update(str(mpl._get_executable_info("inkscape").version).encode('utf-8'))

returnmd5.hexdigest()
returnsha256.hexdigest()


class _ConverterError(Exception):
Expand Down
5 changes: 4 additions & 1 deletionlib/matplotlib/texmanager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -168,7 +168,10 @@ def get_basefile(cls, tex, fontsize, dpi=None):
Return a filename based on a hash of the string, fontsize, and dpi.
"""
src = cls._get_tex_source(tex, fontsize) + str(dpi)
filehash = hashlib.md5(src.encode('utf-8')).hexdigest()
filehash = hashlib.sha256(
src.encode('utf-8'),
usedforsecurity=False
).hexdigest()
filepath = Path(cls._texcache)

num_letters, num_levels = 2, 2
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp