def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32):
 salt = os.urandom(saltSize)
 password = password.encode(u'utf-8')
 hash = pbkdf2(password, salt, iterations, digestMod)
 digestname = digestMod.__name__.replace(u'openssl_', u'')
 return (digestname, iterations, salt, hash)

def hashPasswordTuple ( password , digestMod = hashlib . sha512 , iterations = 10000 , saltSize = 32 ) : salt = os . urandom ( saltSize ) password = password . encode ( u'utf-8' ) hash = pbkdf2 ( password , salt , iterations , digestMod ) digestname = digestMod . __name__ . replace ( u'openssl_' , u'' ) return ( digestname , iterations , salt , hash )
module function to hash a password according to the pbkdf2 specification .