Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include all hashlib.new inputs #379

Merged
merged 2 commits into from
Oct 3, 2024
Merged
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
9 changes: 7 additions & 2 deletions tagreader/web_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ 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 TypeError:
# Required for python 3.8
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
Loading