changeset 5318:102bbfe8af43

auth: remove redundant hashlib imports hashlib is already imported at the top of the module (regardless of OS).
author Søren Løvborg <kwi@kwi.dk>
date Sun, 26 Jul 2015 13:58:50 +0200
parents 71c2b7054e55
children 598d0d0c4190
files kallithea/lib/auth.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/auth.py	Sun Jul 26 13:58:50 2015 +0200
+++ b/kallithea/lib/auth.py	Sun Jul 26 13:58:50 2015 +0200
@@ -105,8 +105,7 @@
         :param password: password to hash
         """
         if is_windows:
-            from hashlib import sha256
-            return sha256(str_).hexdigest()
+            return hashlib.sha256(str_).hexdigest()
         elif is_unix:
             import bcrypt
             return bcrypt.hashpw(str_, bcrypt.gensalt(10))
@@ -125,8 +124,7 @@
         """
 
         if is_windows:
-            from hashlib import sha256
-            return sha256(password).hexdigest() == hashed
+            return hashlib.sha256(password).hexdigest() == hashed
         elif is_unix:
             import bcrypt
             return bcrypt.hashpw(password, hashed) == hashed