eric7.Utilities.crypto.py3PBKDF2

Module implementing PBKDF2 functions.

Global Attributes

Delimiter
Hashes

Classes

None

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 (str)
clear text password
digestMod (function)
hash function
iterations (int)
number of times hash function should be applied
saltSize (int)
size of the salt
Return:
hashed password entry according to PBKDF2 specification
Return Type:
str
Up


hashPasswordTuple

hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32)

Module function to hash a password according to the PBKDF2 specification.

password (str)
clear text password
digestMod (function)
hash function
iterations (int)
number of times hash function should be applied
saltSize (int)
size of the salt
Return:
tuple of digestname, number of iterations, salt and hashed password
Return Type:
tuple of (str, int, bytes, bytes)
Up


pbkdf2

pbkdf2(password, salt, iterations, digestMod)

Module function to hash a password according to the PBKDF2 specification.

password (bytes)
clear text password
salt (bytes)
salt value
iterations (int)
number of times hash function should be applied
digestMod (function)
hash function
Return:
hashed password
Return Type:
bytes
Up


rehashPassword

rehashPassword(password, hashParameters)

Module function to recreate a password hash given the hash parameters.

password (str)
clear text password
hashParameters (str)
hash parameters in the form 'digestmod$iterations$salt'
Return:
hashed password
Return Type:
bytes
Raises ValueError:
the hash parameters string is not of the expected format or the digest is not one of the known ones
Up


verifyPassword

verifyPassword(password, pwHash)

Module function to verify a password against a hash encoded password.

password (str)
clear text password
pwHash (str)
hash encoded password in the form 'digestmod$iterations$salt$hashed_password' as produced by the hashPassword function
Return:
flag indicating a successfull verification
Return Type:
bool
Raises ValueError:
the hash is not of the expected format or the digest is not one of the known ones
Up