From 71cde670d5b7f2e9e16d860545d0c36aee115dad Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Mon, 28 Nov 2016 01:22:08 -0500 Subject: [PATCH] Use sha512.hash() instead of .encrypt() Now that we have switched to passlib 1.7.0, remove the temporary workaround and use the new function. Change-Id: Id574221f65d72a763b8205df0891b6e300856230 Depends-On: I6525dc8cf305ae03b81a53ac7fd06bf63d4a6d48 Closes-Bug: 1644263 --- keystone/common/utils.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/keystone/common/utils.py b/keystone/common/utils.py index c656545090..342037b08b 100644 --- a/keystone/common/utils.py +++ b/keystone/common/utils.py @@ -132,14 +132,8 @@ def hash_user_password(user): def hash_password(password): """Hash a password. Hard.""" password_utf8 = verify_length_and_trunc_password(password).encode('utf-8') - try: - return passlib.hash.sha512_crypt.encrypt( - password_utf8, rounds=CONF.crypt_strength) - except DeprecationWarning: - # TODO(stevemar): Remove this try/except once we switch over to passlib - # version 1.7.0 and replace encrypt() with hash() - return passlib.hash.sha512_crypt.hash( - password_utf8, rounds=CONF.crypt_strength) + return passlib.hash.sha512_crypt.hash( + password_utf8, rounds=CONF.crypt_strength) def check_password(password, hashed):