diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-04-06 12:35:25 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-04-06 12:35:25 -0400 |
| commit | 37a3954c8bac9ade1cdcc0f86e2c2fb7f1d312fc (patch) | |
| tree | 56eb7b2bef0bb8ec4d9e94ac338d06019354327c /passlib/utils | |
| parent | 3da23d45e03f7cb26374a3546106387b8a293ad3 (diff) | |
| download | passlib-37a3954c8bac9ade1cdcc0f86e2c2fb7f1d312fc.tar.gz | |
minor additions to documentation
Diffstat (limited to 'passlib/utils')
| -rw-r--r-- | passlib/utils/__init__.py | 6 | ||||
| -rw-r--r-- | passlib/utils/pbkdf2.py | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index 230b701..865909f 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -155,11 +155,11 @@ def is_crypt_context(obj): #================================================================================= #string helpers #================================================================================= -def splitcomma(source): - "split comma separated string into list elements, stripping whitespace and empty elements" +def splitcomma(source, sep=","): + "split comma-separated string into list of elements, stripping whitespace and discarding empty elements" return [ elem.strip() - for elem in source.split(",") + for elem in source.split(sep) if elem.strip() ] diff --git a/passlib/utils/pbkdf2.py b/passlib/utils/pbkdf2.py index acc9c1f..6e0222a 100644 --- a/passlib/utils/pbkdf2.py +++ b/passlib/utils/pbkdf2.py @@ -100,16 +100,16 @@ def pbkdf2(secret, salt, rounds, keylen, prf="hmac-sha1"): :arg keylen: number of bytes to generate :param prf: psuedo-random function to use for key strengthening. - should be a callable of the form ``prf(secret, plaintext) -> ciphertext``, - or a string ``hmac-xxx`` where ``xxx`` is the name - of a hash function recognized by :func:`M2Crypto.EVP.hmac` (if present), - or :func:`hashlib.new`. - Defaults to ``hmac-sha1``, the only prf defined - by the PBKDF2 specification. - - This function attempts to use M2Crypto as a backend - if available and if the digest is a string supported - by M2Crypto. Otherwise it falls back to a software implementation. + if specified, it must be one of the following: + + * a callable with the prototype ``prf(secret, plaintext) -> ciphertext`` + * a string of the form :samp:`hmac-{digest}`, where :samp:`{digest}` + is the name of a hash function such as ``md5``, ``sha256``, etc. + + this defaults to ``hmac-sha1``, the only prf listed in the PBKDF2 specification. + + If M2Crypto is present, and supports the specified prf, + :func:`M2Crypto.EVP.hmac` will be used to accelerate this function. :returns: raw bytes of generated key |
