eric6.Utilities.crypto.py3PBKDF2
Module implementing PBKDF2 functions.
Global Attributes
Classes
Functions
hashPassword |
Module function to hash a password according to the PBKDF2 specification. |
hashPasswordTuple |
Module function to hash a password according to the PBKDF2 specification. |
pbkdf2 |
Module function to hash a password according to the PBKDF2 specification. |
rehashPassword |
Module function to recreate a password hash given the hash parameters. |
verifyPassword |
Module function to verify a password against a hash encoded password. |
hashPassword
hashPassword(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32)
Module function to hash a password according to the PBKDF2 specification.
- password
-
clear text password (string)
- digestMod
-
hash function
- iterations
-
number of times hash function should be applied (integer)
- saltSize
-
size of the salt (integer)
- Returns:
-
hashed password entry according to PBKDF2 specification (string)
hashPasswordTuple
hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32)
Module function to hash a password according to the PBKDF2 specification.
- password
-
clear text password (string)
- digestMod
-
hash function
- iterations
-
number of times hash function should be applied (integer)
- saltSize
-
size of the salt (integer)
- Returns:
-
tuple of digestname (string), number of iterations (integer),
salt (bytes) and hashed password (bytes)
pbkdf2
pbkdf2(password, salt, iterations, digestMod)
Module function to hash a password according to the PBKDF2 specification.
- password
-
clear text password (bytes)
- salt
-
salt value (bytes)
- iterations
-
number of times hash function should be applied (integer)
- digestMod
-
hash function
- Returns:
-
hashed password (bytes)
rehashPassword
rehashPassword(password, hashParameters)
Module function to recreate a password hash given the hash parameters.
- password
-
clear text password (string)
- hashParameters
-
hash parameters in the form
'digestmod$iterations$salt' (string)
- Returns:
-
hashed password (bytes)
- Raises ValueError:
-
the hash parameters string is not of the expected
format or the digest is not one of the known ones
verifyPassword
verifyPassword(password, pwHash)
Module function to verify a password against a hash encoded password.
- password
-
clear text password (string)
- pwHash
-
hash encoded password in the form
'digestmod$iterations$salt$hashed_password' as produced by the
hashPassword function (string)
- Returns:
-
flag indicating a successfull verification (boolean)
- Raises ValueError:
-
the hash is not of the expected format or the
digest is not one of the known ones