Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions doc/api/next_api_changes/behavior/18193-BKB.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ID attribute of XML tags in SVG files now based on SHA256 rather than MD5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Matplotlib generates unique ID attributes for various tags in SVG files.
Matplotlib previously generated these unique IDs using the first 10
characters of an MD5 hash. The MD5 hashing algorithm is not available in
Python on systems with Federal Information Processing Standards (FIPS)
enabled. Matplotlib now uses the first 10 characters of an SHA256 hash
instead. SVG files that would otherwise match those saved with earlier
versions of matplotlib, will have different ID attributes.
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def _make_id(self, type, content):
salt = mpl.rcParams['svg.hashsalt']
if salt is None:
salt = str(uuid.uuid4())
m = hashlib.md5()
m = hashlib.sha256()
m.update(salt.encode('utf8'))
m.update(str(content).encode('utf8'))
return '%s%s' % (type, m.hexdigest()[:10])
Expand Down