Show More
@@ -28,6 +28,7 b' import hashlib' | |||||
28 | import itertools |
|
28 | import itertools | |
29 | import logging |
|
29 | import logging | |
30 | import os |
|
30 | import os | |
|
31 | import string | |||
31 |
|
32 | |||
32 | import ipaddr |
|
33 | import ipaddr | |
33 | from decorator import decorator |
|
34 | from decorator import decorator | |
@@ -109,8 +110,9 b' def check_password(password, hashed):' | |||||
109 | :param password: password |
|
110 | :param password: password | |
110 | :param hashed: password in hashed form |
|
111 | :param hashed: password in hashed form | |
111 | """ |
|
112 | """ | |
112 |
|
113 | # sha256 hashes will always be 64 hex chars | ||
113 | if is_windows: |
|
114 | # bcrypt hashes will always contain $ (and be shorter) | |
|
115 | if is_windows or len(hashed) == 64 and all(x in string.hexdigits for x in hashed): | |||
114 | return hashlib.sha256(password).hexdigest() == hashed |
|
116 | return hashlib.sha256(password).hexdigest() == hashed | |
115 | elif is_unix: |
|
117 | elif is_unix: | |
116 | import bcrypt |
|
118 | import bcrypt |
General Comments 0
You need to be logged in to leave comments.
Login now