new syntax pbkdf2(1000,20,sha1)
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-07-18 13:40:06) dev
|
Version 2.00.0 (2012-07-18 13:46:20) dev
|
||||||
|
|||||||
+3
-2
@@ -73,8 +73,9 @@ def get_digest(value):
|
|||||||
|
|
||||||
def hmac_hash(value, salt, digest_alg='md5'):
|
def hmac_hash(value, salt, digest_alg='md5'):
|
||||||
if isinstance(digest_alg,str) and digest_alg.startswith('pbkdf2'):
|
if isinstance(digest_alg,str) and digest_alg.startswith('pbkdf2'):
|
||||||
iterations, keylen = digest_alg[7:-1].split(',')
|
iterations, keylen, alg = digest_alg[7:-1].split(',')
|
||||||
return pbkdf2_hex(value, salt, int(iterations), int(keylen))
|
return pbkdf2_hex(value, salt, int(iterations),
|
||||||
|
int(keylen),get_digest(alg))
|
||||||
digest_alg = get_digest(digest_alg)
|
digest_alg = get_digest(digest_alg)
|
||||||
d = hmac.new(salt,value,digest_alg)
|
d = hmac.new(salt,value,digest_alg)
|
||||||
return d.hexdigest()
|
return d.hexdigest()
|
||||||
|
|||||||
+1
-1
@@ -2551,7 +2551,7 @@ class LazyCrypt(object):
|
|||||||
key = 'md5:uuid'
|
key = 'md5:uuid'
|
||||||
key = 'sha512:uuid'
|
key = 'sha512:uuid'
|
||||||
...
|
...
|
||||||
key = 'pbkdf2(100,64):uuid' 100 iterations and 64 chars length
|
key = 'pbkdf2(1000,64,sha512):uuid' 1000 iterations and 64 chars length
|
||||||
"""
|
"""
|
||||||
if self.crypted:
|
if self.crypted:
|
||||||
return self.crypted
|
return self.crypted
|
||||||
|
|||||||
Reference in New Issue
Block a user