keystone.common.password_hashers.bcrypt module¶
- class keystone.common.password_hashers.bcrypt.Bcrypt[source]¶
- Bases: - PasswordHasher- passlib transition class for implementing bcrypt password hashing - static hash(password: bytes, rounds: int = 12, **kwargs) str[source]¶
- Generate password hash string with ident and params - https://pypi.org/project/bcrypt/ - Parameters:
- password (bytes) – Password to be hashed. 
- round (int) – Count of rounds. 
 
- Returns:
- String in format $2b${rounds}${salt}{digest} 
 
 - ident_values: set[str] = {'$2$', '$2a$', '$2b$', '$2x$', '$2y$'}¶
 - name: str = 'bcrypt'¶
 - static verify(password: bytes, hashed: str) bool[source]¶
- Verify hashing password would be equal to the hashed value - Parameters:
- password (bytes) – Password to verify 
- hashed (string) – Hashed password. Used to extract hashing parameters 
 
- Returns:
- boolean whether hashing password with the same parameters would match hashed value 
 
 
- class keystone.common.password_hashers.bcrypt.Bcrypt_sha256[source]¶
- Bases: - PasswordHasher- passlib transition class for bcrypt_sha256 password hashing - static hash(password: bytes, rounds: int = 12, **kwargs) str[source]¶
- Generate password hash string with ident and params - https://pypi.org/project/bcrypt/ - Parameters:
- password (bytes) – Password to be hashed. 
- round (int) – Count of rounds. 
 
- Returns:
- String in format $bcrypt-sha256$r={rounds},t={ident},v={version}${salt}${digest} 
 
 - ident_values: set[str] = {'$2a$', '$2b$'}¶
 - name: str = 'bcrypt_sha256'¶
 - prefix: str = '$bcrypt-sha256$'¶
 - static verify(password: bytes, hashed: str) bool[source]¶
- Verify hashing password would be equal to the hashed value - Parameters:
- password (bytes) – Password to verify 
- hashed (string) – Hashed password. Used to extract hashing parameters 
 
- Returns:
- boolean whether hashing password with the same parameters would match hashed value 
 
 
