summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0bb9d68)
raw | patch | inline | side by side (parent: 0bb9d68)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 16 Apr 2011 18:38:18 +0000 (18:38 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 16 Apr 2011 18:38:18 +0000 (18:38 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4600 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/anypy/hashlib_.py | patch | blob | history | |
roundup/password.py | patch | blob | history |
index 9365b97dabd090b34c2a8c41dfdfe449a1715734..779176f4fceb7040fb314539a356a57e4bf67df9 100644 (file)
try:
from hashlib import md5, sha1 # new in Python 2.5
+ shamodule = sha1
except ImportError:
from md5 import md5 # deprecated in Python 2.6
from sha import sha as sha1 # deprecated in Python 2.6
+ import sha as shamodule
# vim: ts=8 sts=4 sw=4 si
diff --git a/roundup/password.py b/roundup/password.py
index eab300775b9c8a7869904c08aebc21d528f69160..006c591be99cf39f6960b973bd3b48b8fa68b023 100644 (file)
--- a/roundup/password.py
+++ b/roundup/password.py
import re, string, random
from base64 import b64encode, b64decode
-from roundup.anypy.hashlib_ import md5, sha1
+from roundup.anypy.hashlib_ import md5, sha1, shamodule
try:
import crypt
except ImportError:
#no m2crypto - make our own pbkdf2 function
from struct import pack
from hmac import HMAC
- try:
- from hashlib import sha1
- except ImportError:
- from sha import new as sha1
def xor_bytes(left, right):
"perform bitwise-xor of two byte-strings"
def _pbkdf2(password, salt, rounds, keylen):
digest_size = 20 # sha1 generates 20-byte blocks
total_blocks = int((keylen+digest_size-1)/digest_size)
- hmac_template = HMAC(password, None, sha1)
+ hmac_template = HMAC(password, None, shamodule)
out = _bempty
for i in xrange(1, total_blocks+1):
hmac = hmac_template.copy()