[Python-ideas] Add adaptive-load salt-mandatory hashing functions?

Simon Sapin simon.sapin at kozea.fr
Sun Jun 10 16:17:22 CEST 2012


Le 10/06/2012 15:05, Masklinn a écrit :
> The standard library already provides for cryptographic hashes (hashlib)
> and MACs (hmac).
>
> [snip]
>
> Therefore, I would suggest either adding a new module (name tbd) or
> adding new constructors to hashlib.

PBKDF2 can be implemented in 15 lines of code based on the hmac and 
hashlib modules:

https://github.com/mitsuhiko/python-pbkdf2/blob/master/pbkdf2.py

Although the code is short, it is easy to get wrong. So I think it would 
be nice to have in the stdlib, tested once and for all.

Also, PBKDF2 is a well-defined spec that will not change (or it will be 
called PBKDF3 or something) which I think makes it a good fit for the 
stdlib.

I would suggest to have Armin’s implementation (linked above) included 
as-is, but it’s probably too late for 3.3.

-- 
Simon Sapin



More information about the Python-ideas mailing list