Skip to main content

BCryptPasswordHasher

Secure password hashing using the bcrypt algorithm

This is considered by many to be the most secure algorithm but you must first install the bcrypt library. Please be warned that this library depends on native C code and might cause portability issues.

This hasher does not first hash the password which means it is subject to bcrypt's 72 bytes password truncation. Most use cases should prefer the BCryptSHA256PasswordHasher.

Attributes

AttributeTypeDescription
algorithmstring = bcryptThe unique identifier for the hashing algorithm used to label and identify password hashes.
digestnullThe HMAC digest algorithm used for pre-hashing, which is explicitly disabled in this class to allow direct bcrypt processing.

Constructor

Signature

def BCryptPasswordHasher() - > null

Methods


algorithm()

def algorithm() - > string

The identifier for the hashing algorithm used by this class.

Returns

TypeDescription
stringThe string 'bcrypt' used to identify this specific hasher implementation.

digest()

def digest() - > null

The hashing function or digest algorithm used during the password derivation process.

Returns

TypeDescription
nullReturns null as this specific hasher does not apply an initial digest before bcrypt processing.