diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-12-06 13:08:37 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-12-06 13:08:37 -0500 |
| commit | d6fcf25604f6ba18f5f93e66dec183e25c5eee6a (patch) | |
| tree | 8c9a9849fc986c3ecd4e15784b5a82734cb7caa3 /passlib/utils/pbkdf2.py | |
| parent | 42ca0e1914a58c971251a30706bfed41d4f2122d (diff) | |
| download | passlib-d6fcf25604f6ba18f5f93e66dec183e25c5eee6a.tar.gz | |
replaced (int,long) instance checks with compat.int_types
Diffstat (limited to 'passlib/utils/pbkdf2.py')
| -rw-r--r-- | passlib/utils/pbkdf2.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/passlib/utils/pbkdf2.py b/passlib/utils/pbkdf2.py index 77875c3..9a7ee7c 100644 --- a/passlib/utils/pbkdf2.py +++ b/passlib/utils/pbkdf2.py @@ -21,7 +21,7 @@ except ImportError: _EVP = None #pkg from passlib.utils import xor_bytes, to_bytes, native_str, b, bytes -from passlib.utils.compat import irange, callable +from passlib.utils.compat import irange, callable, int_types #local __all__ = [ "hmac_sha1", @@ -186,7 +186,7 @@ def pbkdf1(secret, salt, rounds, keylen, hash="sha1"): raise TypeError("salt must be bytes, not %s" % (type(salt),)) #prepare rounds - if not isinstance(rounds, (int, long)): + if not isinstance(rounds, int_types): raise TypeError("rounds must be an integer") if rounds < 1: raise ValueError("rounds must be at least 1") @@ -247,7 +247,7 @@ def pbkdf2(secret, salt, rounds, keylen, prf="hmac-sha1"): raise TypeError("salt must be bytes, not %s" % (type(salt),)) #prepare rounds - if not isinstance(rounds, (int, long)): + if not isinstance(rounds, int_types): raise TypeError("rounds must be an integer") if rounds < 1: raise ValueError("rounds must be at least 1") @@ -270,7 +270,7 @@ def pbkdf2(secret, salt, rounds, keylen, prf="hmac-sha1"): #figure out how many blocks we'll need bcount = (keylen+digest_size-1)//digest_size if bcount >= MAX_BLOCKS: - raise ValueError("key length to long") + raise ValueError("key length too long") #build up key from blocks out = BytesIO() |
