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

Appearance settings

Commit 938ad62

Browse filesBrowse files
committed
add in usedforsecurity=False to communicate that these hashing applications are not used for security-based purposes
1 parent c830f5c commit 938ad62
Copy full SHA for 938ad62

File tree

3 files changed

+9
-3
lines changed
Filter options

3 files changed

+9
-3
lines changed

‎lib/matplotlib/sphinxext/mathmpl.py

Copy file name to clipboardExpand all lines: lib/matplotlib/sphinxext/mathmpl.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ def latex2html(node, source):
146146
fontset = node['fontset']
147147
fontsize = node['fontsize']
148148
name = 'math-{}'.format(
149-
hashlib.sha256(f'{latex}{fontset}{fontsize}'.encode()).hexdigest()[-10:])
149+
hashlib.sha256(
150+
f'{latex}{fontset}{fontsize}'.encode(),
151+
usedforsecurity=False,
152+
).hexdigest()[-10:])
150153

151154
destdir = Path(setup.app.builder.outdir, '_images', 'mathmpl')
152155
destdir.mkdir(parents=True, exist_ok=True)

‎lib/matplotlib/testing/compare.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/compare.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_cache_dir():
4646

4747

4848
def get_file_hash(path, block_size=2 ** 20):
49-
sha256 = hashlib.sha256()
49+
sha256 = hashlib.sha256(usedforsecurity=False)
5050
with open(path, 'rb') as fd:
5151
while True:
5252
data = fd.read(block_size)

‎lib/matplotlib/texmanager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/texmanager.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ def get_basefile(cls, tex, fontsize, dpi=None):
168168
Return a filename based on a hash of the string, fontsize, and dpi.
169169
"""
170170
src = cls._get_tex_source(tex, fontsize) + str(dpi)
171-
filehash = hashlib.sha256(src.encode('utf-8')).hexdigest()
171+
filehash = hashlib.sha256(
172+
src.encode('utf-8'),
173+
usedforsecurity=False
174+
).hexdigest()
172175
filepath = Path(cls._texcache)
173176

174177
num_letters, num_levels = 2, 2

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.