Skip to main content

get_hasher

Return an instance of a loaded password hasher.

If algorithm is 'default', return the default hasher. Lazily import hashers specified in the project's settings file if needed.

def get_hasher(
algorithm: string = default
) - > BasePasswordHasher

Return an instance of a loaded password hasher. If algorithm is 'default', return the default hasher. Lazily import hashers specified in the project's settings file if needed.

Parameters

NameTypeDescription
algorithmstring = defaultThe identifier of the hashing algorithm to retrieve, or 'default' to fetch the primary hasher defined in settings

Returns

TypeDescription
BasePasswordHasherAn instance of the requested password hasher class used for password verification or hashing