Skip to content

Commit 5133e6d

Browse files
authored
Merge pull request #1821 from UlrichB22/fix-hash
add usedforsecurity False in hash functions
2 parents 905a158 + d067c59 commit 5133e6d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/moin/utils/crypto.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def cache_key(**kw):
117117
118118
:param kw: keys/values to compute cache key from
119119
"""
120-
return hashlib.md5(repr(kw).encode()).hexdigest()
120+
return hashlib.md5(repr(kw).encode(), usedforsecurity=False).hexdigest()
121121

122122

123123
def hash_hexdigest(content, bufsize=4096):

src/moin/utils/plugins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _loadPluginModule(cfg):
202202
cfg._plugin_modules = []
203203
for pdir in cfg.plugin_dirs:
204204
assert isinstance(pdir, str)
205-
modname = "moin_p_{}".format(hashlib.new("sha1", pdir.encode()).hexdigest())
205+
modname = "moin_p_{}".format(hashlib.new("sha1", pdir.encode(), usedforsecurity=False).hexdigest())
206206
if modname not in sys.modules:
207207
init_path = os.path.join(os.path.abspath(pdir), "__init__.py")
208208
spec = importlib.util.spec_from_file_location(modname, init_path)

0 commit comments

Comments
 (0)