We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14d6f18 commit 91a8ac2Copy full SHA for 91a8ac2
roundup/anypy/hashlib_.py
@@ -4,8 +4,10 @@
4
5
try:
6
from hashlib import md5, sha1 # new in Python 2.5
7
+ shamodule = sha1
8
except ImportError:
9
from md5 import md5 # deprecated in Python 2.6
10
from sha import sha as sha1 # deprecated in Python 2.6
11
+ import sha as shamodule
12
13
# vim: ts=8 sts=4 sw=4 si
roundup/password.py
@@ -23,7 +23,7 @@
23
24
import re, string, random
25
from base64 import b64encode, b64decode
26
-from roundup.anypy.hashlib_ import md5, sha1
+from roundup.anypy.hashlib_ import md5, sha1, shamodule
27
28
import crypt
29
@@ -59,10 +59,6 @@ def h64decode(data):
59
#no m2crypto - make our own pbkdf2 function
60
from struct import pack
61
from hmac import HMAC
62
- try:
63
- from hashlib import sha1
64
- except ImportError:
65
- from sha import new as sha1
66
67
def xor_bytes(left, right):
68
"perform bitwise-xor of two byte-strings"
@@ -71,7 +67,7 @@ def xor_bytes(left, right):
71
def _pbkdf2(password, salt, rounds, keylen):
72
digest_size = 20 # sha1 generates 20-byte blocks
73
69
total_blocks = int((keylen+digest_size-1)/digest_size)
74
- hmac_template = HMAC(password, None, sha1)
70
+ hmac_template = HMAC(password, None, shamodule)
75
out = _bempty
76
for i in xrange(1, total_blocks+1):
77
hmac = hmac_template.copy()
0 commit comments