diff -r 9986ec0e559a -r 10516539f238 Utilities/crypto/py3PBKDF2.py --- a/Utilities/crypto/py3PBKDF2.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Utilities/crypto/py3PBKDF2.py Fri Oct 18 23:00:41 2013 +0200 @@ -42,7 +42,8 @@ return hash -def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): +def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, + saltSize=32): """ Module function to hash a password according to the PBKDF2 specification. @@ -60,7 +61,8 @@ return digestname, iterations, salt, hash -def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): +def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, + saltSize=32): """ Module function to hash a password according to the PBKDF2 specification. @@ -96,13 +98,14 @@ digestname, iterations, salt, pwHash = hash.split(Delimiter) except ValueError: raise ValueError( - "Expected hash encoded password in format "\ - "'digestmod{0}iterations{0}salt{0}hashed_password".format(Delimiter)) + "Expected hash encoded password in format " + "'digestmod{0}iterations{0}salt{0}hashed_password" + .format(Delimiter)) if digestname not in Hashes.keys(): raise ValueError( - "Unsupported hash algorithm '{0}' for hash encoded password '{1}'.".format( - digestname, hash)) + "Unsupported hash algorithm '{0}' for hash encoded password '{1}'." + .format(digestname, hash)) iterations = int(iterations) salt = base64.b64decode(salt.encode("ascii")) @@ -119,8 +122,8 @@ @param hashParameters hash parameters in the form 'digestmod$iterations$salt' (string) @return hashed password (bytes) - @exception ValueError the hash parameters string is not of the expected format - or the digest is not one of the known ones + @exception ValueError the hash parameters string is not of the expected + format or the digest is not one of the known ones """ try: digestname, iterations, salt = hashParameters.split(Delimiter) @@ -131,8 +134,8 @@ if digestname not in Hashes.keys(): raise ValueError( - "Unsupported hash algorithm '{0}' for hash parameters '{1}'.".format( - digestname, hash)) + "Unsupported hash algorithm '{0}' for hash parameters '{1}'." + .format(digestname, hash)) iterations = int(iterations) salt = base64.b64decode(salt.encode("ascii"))