Skip to content

Commit

Permalink
fix: include all hashlib.new inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Sep 25, 2024
1 parent eb644c6 commit 15f02ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tagreader/web_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ def hexdigest(self):
return self._hash_obj.hexdigest()


def patched_hashlib_new(name, data=b""):
def patched_hashlib_new(name, data=b"", usedforsecurity=True):
if name.lower() == "md4":
return MD4(data)
else:
return hashlib_new_method(name, data)
# Try / Catch easier than detecting python version
try:
return hashlib_new_method(name, data=data, usedforsecurity=usedforsecurity)
except:
return hashlib_new_method(name, data=data)


# Monkey-patch md4 in hashlib.new due to missing support for md4 in later releases of Python:
Expand Down

0 comments on commit 15f02ea

Please sign in to comment.