Changeset 1177 for trunk/src/cryptobox/core/settings.py
- Timestamp:
- 06/16/09 04:16:29 (14 months ago)
- Files:
-
- 1 modified
-
trunk/src/cryptobox/core/settings.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cryptobox/core/settings.py
r1158 r1177 444 444 """Load the user database file if it exists. 445 445 """ 446 import StringIO, sha 446 import StringIO 447 try: 448 # hashlib is available since python2.5 449 import hashlib 450 get_hash_obj = lambda text: hashlib.sha1(text) 451 except ImportError: 452 # sha is deprecated since python2.6 453 import sha 454 get_hash_obj = lambda text: sha.new(text) 447 455 user_db_rules = StringIO.StringIO(self.userDatabaseSpec) 448 456 try: … … 469 477 user_db.validate(validate.Validator()) 470 478 ## define password hash function - never use "sha" directly - SPOT 471 user_db.get_digest = lambda password: sha.new(password).hexdigest()479 user_db.get_digest = lambda password: get_hash_obj(password).hexdigest() 472 480 return user_db 473 481
