Show More
@@ -49,7 +49,7 b' from rhodecode.model.db import (' | |||
|
49 | 49 | User, Repository, Permission, UserToPerm, UserGroupToPerm, UserGroupMember, |
|
50 | 50 | UserIpMap, UserApiKeys, RepoGroup, UserGroup) |
|
51 | 51 | from rhodecode.lib import caches |
|
52 | from rhodecode.lib.utils2 import safe_unicode, aslist, safe_str, md5, safe_int | |
|
52 | from rhodecode.lib.utils2 import safe_unicode, aslist, safe_str, md5, safe_int, sha1 | |
|
53 | 53 | from rhodecode.lib.utils import ( |
|
54 | 54 | get_repo_slug, get_repo_group_slug, get_user_group_slug) |
|
55 | 55 | from rhodecode.lib.caching_query import FromCache |
@@ -210,12 +210,12 b' class _RhodeCodeCryptoSha256(_RhodeCodeC' | |||
|
210 | 210 | return hashlib.sha256(password).hexdigest() == hashed |
|
211 | 211 | |
|
212 | 212 | |
|
213 |
class _RhodeCodeCrypto |
|
|
213 | class _RhodeCodeCryptoTest(_RhodeCodeCryptoBase): | |
|
214 | 214 | ENC_PREF = '_' |
|
215 | 215 | |
|
216 | 216 | def hash_create(self, str_): |
|
217 | 217 | self._assert_bytes(str_) |
|
218 |
return |
|
|
218 | return sha1(str_) | |
|
219 | 219 | |
|
220 | 220 | def hash_check(self, password, hashed): |
|
221 | 221 | """ |
@@ -225,18 +225,18 b' class _RhodeCodeCryptoMd5(_RhodeCodeCryp' | |||
|
225 | 225 | :param hashed: password in hashed form |
|
226 | 226 | """ |
|
227 | 227 | self._assert_bytes(password) |
|
228 |
return |
|
|
228 | return sha1(password) == hashed | |
|
229 | 229 | |
|
230 | 230 | |
|
231 | 231 | def crypto_backend(): |
|
232 | 232 | """ |
|
233 | 233 | Return the matching crypto backend. |
|
234 | 234 | |
|
235 |
Selection is based on if we run tests or not, we pick |
|
|
235 | Selection is based on if we run tests or not, we pick sha1-test backend to run | |
|
236 | 236 | tests faster since BCRYPT is expensive to calculate |
|
237 | 237 | """ |
|
238 | 238 | if rhodecode.is_test: |
|
239 |
RhodeCodeCrypto = _RhodeCodeCrypto |
|
|
239 | RhodeCodeCrypto = _RhodeCodeCryptoTest() | |
|
240 | 240 | else: |
|
241 | 241 | RhodeCodeCrypto = _RhodeCodeCryptoBCrypt() |
|
242 | 242 |
General Comments 0
You need to be logged in to leave comments.
Login now