diff -r 2fe91fe443dd -r 328f3ec4b77a src/eric7/Utilities/crypto/py3PBKDF2.py --- a/src/eric7/Utilities/crypto/py3PBKDF2.py Thu Dec 21 15:46:22 2023 +0100 +++ b/src/eric7/Utilities/crypto/py3PBKDF2.py Thu Dec 21 19:50:01 2023 +0100 @@ -28,11 +28,16 @@ """ Module function to hash a password according to the PBKDF2 specification. - @param password clear text password (bytes) - @param salt salt value (bytes) - @param iterations number of times hash function should be applied (integer) + @param password clear text password + @type bytes + @param salt salt value + @type bytes + @param iterations number of times hash function should be applied + @type int @param digestMod hash function - @return hashed password (bytes) + @type function + @return hashed password + @rtype bytes """ pwHash = password for _ in range(iterations): @@ -46,12 +51,16 @@ """ Module function to hash a password according to the PBKDF2 specification. - @param password clear text password (string) + @param password clear text password + @type str @param digestMod hash function - @param iterations number of times hash function should be applied (integer) - @param saltSize size of the salt (integer) - @return tuple of digestname (string), number of iterations (integer), - salt (bytes) and hashed password (bytes) + @type function + @param iterations number of times hash function should be applied + @type int + @param saltSize size of the salt + @type int + @return tuple of digestname, number of iterations, salt and hashed password + @rtype tuple of (str, int, bytes, bytes) """ salt = os.urandom(saltSize) password = password.encode("utf-8") @@ -64,11 +73,16 @@ """ Module function to hash a password according to the PBKDF2 specification. - @param password clear text password (string) + @param password clear text password + @type str @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) + @type function + @param iterations number of times hash function should be applied + @type int + @param saltSize size of the salt + @type int + @return hashed password entry according to PBKDF2 specification + @rtype str """ digestname, iterations, salt, pwHash = hashPasswordTuple( password, digestMod, iterations, saltSize @@ -87,11 +101,14 @@ """ Module function to verify a password against a hash encoded password. - @param password clear text password (string) + @param password clear text password + @type str @param pwHash hash encoded password in the form 'digestmod$iterations$salt$hashed_password' as produced by the - hashPassword function (string) - @return flag indicating a successfull verification (boolean) + hashPassword function + @type str + @return flag indicating a successfull verification + @rtype bool @exception ValueError the hash is not of the expected format or the digest is not one of the known ones """ @@ -121,10 +138,13 @@ """ Module function to recreate a password hash given the hash parameters. - @param password clear text password (string) + @param password clear text password + @type str @param hashParameters hash parameters in the form - 'digestmod$iterations$salt' (string) - @return hashed password (bytes) + 'digestmod$iterations$salt' + @type str + @return hashed password + @rtype bytes @exception ValueError the hash parameters string is not of the expected format or the digest is not one of the known ones """