Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mark md5 as usedforsecurity=False
diff --git a/pulpcore/app/ b/pulpcore/app/
index 604709b4d..87d684df6 100644
--- a/pulpcore/app/
+++ b/pulpcore/app/
@@ -14,6 +14,9 @@ def new(name, *args, **kwargs):
This function raises an exception if a hasher is requested which is not allowed, and otherwise,
returns the standard hasher from ``.
+ Additionally patches md5 to specify `usedforsecurity=False` allowing it to be used even in
+ restricted environments.
name: The name of the hasher to be instantiated.
*args: args to be passed along to the real ``.
@@ -33,4 +36,9 @@ def new(name, *args, **kwargs):
+ if name == "md5":
+ try:
+ return, *args, usedforsecurity=False, **kwargs)
+ except TypeError:
+ pass
return, *args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment