def hashPassword(password, digestMod=hashlib.sha512, iterations=10000,
saltSize=32):
"""
Module function to hash a password according to the PBKDF2 specification.
@param password clear text password (string)
@param digestMod hash function
@param iterations number of times hash function should be applied (integer)
@param saltSize size of the salt (integer)
@return hashed password entry according to PBKDF2 specification (string)
"""
digestname, iterations, salt, hash = \
hashPasswordTuple(password, digestMod, iterations, saltSize)
return Delimiter.join([
digestname,
str(iterations),
base64.b64encode(salt).decode("ascii"),
base64.b64encode(hash).decode("ascii")
])
评论列表
文章目录