new syntax pbkdf2(1000,20,sha1)

This commit is contained in:
mdipierro
2012-07-18 13:46:24 -05:00
parent 0f952cfe5f
commit bafdf36bf3
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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