Skip to content

Commit

Permalink
Merge pull request #1821 from UlrichB22/fix-hash
Browse files Browse the repository at this point in the history
add usedforsecurity False in hash functions
  • Loading branch information
UlrichB22 authored Dec 11, 2024
2 parents 905a158 + d067c59 commit 5133e6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/moin/utils/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/moin/utils/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5133e6d

Please sign in to comment.