From d067c59c1eb589afbedb66c831d21f01ddbd7efb Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:53:32 +0100 Subject: [PATCH] add usedforsecurity False in hash functions --- src/moin/utils/crypto.py | 2 +- src/moin/utils/plugins.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moin/utils/crypto.py b/src/moin/utils/crypto.py index 5b846cad6..7cc17a7e0 100644 --- a/src/moin/utils/crypto.py +++ b/src/moin/utils/crypto.py @@ -117,7 +117,7 @@ def cache_key(**kw): :param kw: keys/values to compute cache key from """ - return hashlib.md5(repr(kw).encode()).hexdigest() + return hashlib.md5(repr(kw).encode(), usedforsecurity=False).hexdigest() def hash_hexdigest(content, bufsize=4096): diff --git a/src/moin/utils/plugins.py b/src/moin/utils/plugins.py index 203309d58..04be3e375 100644 --- a/src/moin/utils/plugins.py +++ b/src/moin/utils/plugins.py @@ -202,7 +202,7 @@ def _loadPluginModule(cfg): cfg._plugin_modules = [] for pdir in cfg.plugin_dirs: assert isinstance(pdir, str) - modname = "moin_p_{}".format(hashlib.new("sha1", pdir.encode()).hexdigest()) + modname = "moin_p_{}".format(hashlib.new("sha1", pdir.encode(), usedforsecurity=False).hexdigest()) if modname not in sys.modules: init_path = os.path.join(os.path.abspath(pdir), "__init__.py") spec = importlib.util.spec_from_file_location(modname, init_path)