diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-06-20 17:57:54 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-06-20 17:57:54 -0400 |
| commit | 8ff40096413e4e63f800199898d4515b3cc078f0 (patch) | |
| tree | e91fe66eaf2513301d9a2392d5d0eabe5608cb6c | |
| parent | d34a6be1b786ed404a4017fd41202f2605ed6b26 (diff) | |
| download | passlib-8ff40096413e4e63f800199898d4515b3cc078f0.tar.gz | |
GenericHandler.checksum_chars now defaults to ``None``, instead of implicit H64_CHARS
| -rw-r--r-- | passlib/handlers/bcrypt.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/des_crypt.py | 5 | ||||
| -rw-r--r-- | passlib/handlers/fshp.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/ldap_digests.py | 2 | ||||
| -rw-r--r-- | passlib/handlers/md5_crypt.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/mysql.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/pbkdf2.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/phpass.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/sha1_crypt.py | 1 | ||||
| -rw-r--r-- | passlib/handlers/sha2_crypt.py | 2 | ||||
| -rw-r--r-- | passlib/handlers/sun_md5_crypt.py | 1 | ||||
| -rw-r--r-- | passlib/utils/handlers.py | 3 |
12 files changed, 18 insertions, 2 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py index 89fd05e..5ced795 100644 --- a/passlib/handlers/bcrypt.py +++ b/passlib/handlers/bcrypt.py @@ -74,6 +74,7 @@ class bcrypt(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.HasManyBackends, uh. name = "bcrypt" setting_kwds = ("salt", "rounds", "ident") checksum_size = 31 + checksum_chars = uh.H64_CHARS #--HasManyIdents-- default_ident = u"$2a$" diff --git a/passlib/handlers/des_crypt.py b/passlib/handlers/des_crypt.py index d916128..0cbe7a8 100644 --- a/passlib/handlers/des_crypt.py +++ b/passlib/handlers/des_crypt.py @@ -162,6 +162,7 @@ class des_crypt(uh.HasManyBackends, uh.HasSalt, uh.GenericHandler): #--GenericHandler-- name = "des_crypt" setting_kwds = ("salt",) + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = max_salt_size = 2 @@ -271,6 +272,7 @@ class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler name = "bsdi_crypt" setting_kwds = ("salt", "rounds") checksum_size = 11 + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = max_salt_size = 4 @@ -371,7 +373,7 @@ class bigcrypt(uh.HasSalt, uh.GenericHandler): #--GenericHandler-- name = "bigcrypt" setting_kwds = ("salt",) - checksum_chars = h64.CHARS + checksum_chars = uh.H64_CHARS #NOTE: checksum chars must be multiple of 11 #--HasSalt-- @@ -464,6 +466,7 @@ class crypt16(uh.HasSalt, uh.GenericHandler): name = "crypt16" setting_kwds = ("salt",) checksum_size = 22 + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = max_salt_size = 2 diff --git a/passlib/handlers/fshp.py b/passlib/handlers/fshp.py index c93b8a8..983ac69 100644 --- a/passlib/handlers/fshp.py +++ b/passlib/handlers/fshp.py @@ -57,6 +57,7 @@ class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): #--GenericHandler-- name = "fshp" setting_kwds = ("salt", "salt_size", "rounds", "variant") + checksum_chars = uh.PADDED_B64_CHARS #--HasRawSalt-- default_salt_size = 16 #current passlib default, FSHP uses 8 diff --git a/passlib/handlers/ldap_digests.py b/passlib/handlers/ldap_digests.py index 6711b8b..9a12160 100644 --- a/passlib/handlers/ldap_digests.py +++ b/passlib/handlers/ldap_digests.py @@ -43,6 +43,7 @@ class _Base64DigestHelper(uh.StaticHandler): ident = None #required - prefix identifier _hash_func = None #required - hash function _pat = None #required - regexp to recognize hash + checksum_chars = uh.PADDED_B64_CHARS @classmethod def identify(cls, hash): @@ -63,6 +64,7 @@ class _Base64DigestHelper(uh.StaticHandler): class _SaltedBase64DigestHelper(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): "helper for ldap_salted_md5 / ldap_salted_sha1" setting_kwds = ("salt",) + checksum_chars = uh.PADDED_B64_CHARS ident = None #required - prefix identifier _hash_func = None #required - hash function diff --git a/passlib/handlers/md5_crypt.py b/passlib/handlers/md5_crypt.py index 4a7627a..74968c2 100644 --- a/passlib/handlers/md5_crypt.py +++ b/passlib/handlers/md5_crypt.py @@ -161,6 +161,7 @@ class _Md5Common(uh.HasSalt, uh.GenericHandler): setting_kwds = ("salt", "salt_size") #ident in subclass checksum_size = 22 + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = 0 diff --git a/passlib/handlers/mysql.py b/passlib/handlers/mysql.py index 597be0b..138d970 100644 --- a/passlib/handlers/mysql.py +++ b/passlib/handlers/mysql.py @@ -51,6 +51,7 @@ class mysql323(uh.StaticHandler): #class attrs #========================================================= name = "mysql323" + checksum_chars = uh.HEX_CHARS _pat = re.compile(ur"^[0-9a-f]{16}$", re.I) diff --git a/passlib/handlers/pbkdf2.py b/passlib/handlers/pbkdf2.py index 5283dfb..3859517 100644 --- a/passlib/handlers/pbkdf2.py +++ b/passlib/handlers/pbkdf2.py @@ -35,6 +35,7 @@ class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.Gen #--GenericHandler-- setting_kwds = ("salt", "salt_size", "rounds") + checksum_chars = uh.H64_CHARS #--HasSalt-- default_salt_size = 16 diff --git a/passlib/handlers/phpass.py b/passlib/handlers/phpass.py index 9e6b9c0..01e9f8f 100644 --- a/passlib/handlers/phpass.py +++ b/passlib/handlers/phpass.py @@ -55,6 +55,7 @@ class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): #--GenericHandler-- name = "phpass" setting_kwds = ("salt", "rounds", "ident") + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = max_salt_size = 8 diff --git a/passlib/handlers/sha1_crypt.py b/passlib/handlers/sha1_crypt.py index 8273000..c99ca69 100644 --- a/passlib/handlers/sha1_crypt.py +++ b/passlib/handlers/sha1_crypt.py @@ -59,6 +59,7 @@ class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler setting_kwds = ("salt", "salt_size", "rounds") ident = u"$sha1$" checksum_size = 28 + checksum_chars = uh.H64_CHARS #--HasSalt-- default_salt_size = 8 diff --git a/passlib/handlers/sha2_crypt.py b/passlib/handlers/sha2_crypt.py index 58effd8..914d955 100644 --- a/passlib/handlers/sha2_crypt.py +++ b/passlib/handlers/sha2_crypt.py @@ -248,6 +248,7 @@ class sha256_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandl name = "sha256_crypt" setting_kwds = ("salt", "rounds", "implicit_rounds", "salt_size") ident = u"$5$" + checksum_chars = uh.H64_CHARS #--HasSalt-- min_salt_size = 0 @@ -400,6 +401,7 @@ class sha512_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandl #========================================================= name = "sha512_crypt" ident = u"$6$" + checksum_chars = uh.H64_CHARS setting_kwds = ("salt", "rounds", "implicit_rounds", "salt_size") diff --git a/passlib/handlers/sun_md5_crypt.py b/passlib/handlers/sun_md5_crypt.py index 9bcb9f7..2fcb0bd 100644 --- a/passlib/handlers/sun_md5_crypt.py +++ b/passlib/handlers/sun_md5_crypt.py @@ -194,6 +194,7 @@ class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): #========================================================= name = "sun_md5_crypt" setting_kwds = ("salt", "rounds", "bare_salt", "salt_size") + checksum_chars = uh.H64_CHARS #NOTE: docs say max password length is 255. #release 9u2 diff --git a/passlib/utils/handlers.py b/passlib/utils/handlers.py index e282526..d8a9c3a 100644 --- a/passlib/utils/handlers.py +++ b/passlib/utils/handlers.py @@ -40,6 +40,7 @@ __all__ = [ #common salt_chars & checksum_chars values H64_CHARS = h64.CHARS B64_CHARS = u"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" +PADDED_B64_CHARS = B64_CHARS + u"=" U64_CHARS = u"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" HEX_CHARS = u"0123456789abcdefABCDEF" UC_HEX_CHARS = u"0123456789ABCDEF" @@ -302,7 +303,7 @@ class GenericHandler(object): ident = None #identifier prefix if known checksum_size = None #if specified, norm_checksum will require this length - checksum_chars = H64_CHARS #if specified, norm_checksum() will validate this + checksum_chars = None #if specified, norm_checksum() will validate this #===================================================== #instance attrs |
