diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-01-19 00:12:16 +0000 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-01-19 00:12:16 +0000 |
| commit | db9b0518f41cfb6aae173263844a896b4615e2c9 (patch) | |
| tree | c3b69c687e6681dfaa0a4f453d182b416d00645e | |
| parent | 15883d9fa4dd8ce437498a0a01c05dd61ea198ba (diff) | |
| download | passlib-db9b0518f41cfb6aae173263844a896b4615e2c9.tar.gz | |
removed HashInfo
| -rw-r--r-- | passlib/tests/test_base.py | 2 | ||||
| -rw-r--r-- | passlib/unix/bcrypt.py | 3 | ||||
| -rw-r--r-- | passlib/unix/md5_crypt.py | 4 | ||||
| -rw-r--r-- | passlib/unix/sha_crypt.py | 2 | ||||
| -rw-r--r-- | passlib/utils/__init__.py | 18 |
5 files changed, 5 insertions, 24 deletions
diff --git a/passlib/tests/test_base.py b/passlib/tests/test_base.py index 29ac2b5..ad2ba2a 100644 --- a/passlib/tests/test_base.py +++ b/passlib/tests/test_base.py @@ -11,7 +11,7 @@ from logging import getLogger #pkg from passlib.base import CryptAlgorithm from passlib.tests.utils import TestCase, enable_suite -from passlib.util import h64_gensalt +from passlib.utils import generate_h64_salt as h64_gensalt #module log = getLogger(__name__) diff --git a/passlib/unix/bcrypt.py b/passlib/unix/bcrypt.py index 8a641a7..3bd2a73 100644 --- a/passlib/unix/bcrypt.py +++ b/passlib/unix/bcrypt.py @@ -8,7 +8,7 @@ import re import logging; log = logging.getLogger(__name__) #site #libs -from passlib.util import HashInfo, validate_h64_salt, generate_h64_salt +from passlib.util import validate_h64_salt, generate_h64_salt from passlib.base import CryptAlgorithmHelper, register_crypt_handler #pkg #local @@ -80,7 +80,6 @@ class BCrypt(CryptAlgorithmHelper): @classmethod def parse(cls, hash): - "helper used to parse bcrypt hash into HashInfo object" m = cls._pat.match(hash) if not m: raise ValueError, "invalid bcrypt hash" diff --git a/passlib/unix/md5_crypt.py b/passlib/unix/md5_crypt.py index ce0c9c1..4f99012 100644 --- a/passlib/unix/md5_crypt.py +++ b/passlib/unix/md5_crypt.py @@ -16,7 +16,7 @@ import os #site #libs from passlib.util import classproperty, abstractmethod, is_seq, srandom, \ - HashInfo, h64_gensalt, h64_encode_3_offsets, h64_encode_1_offset, generate_h64_salt, validate_h64_salt + h64_encode_3_offsets, h64_encode_1_offset, generate_h64_salt, validate_h64_salt from passlib.base import CryptAlgorithmHelper, register_crypt_handler #pkg #local @@ -40,7 +40,7 @@ class Md5Crypt(CryptAlgorithmHelper): #crypt info #========================================================= name = 'md5-crypt' - + setting_kwds = ("salt",) secret_chars = -1 diff --git a/passlib/unix/sha_crypt.py b/passlib/unix/sha_crypt.py index 25f6e04..cd9de9c 100644 --- a/passlib/unix/sha_crypt.py +++ b/passlib/unix/sha_crypt.py @@ -23,7 +23,7 @@ import os #libs from passlib.base import CryptAlgorithmHelper, register_crypt_handler from passlib.util import classproperty, abstractmethod, is_seq, srandom, \ - HashInfo, h64_gensalt, h64_encode_3_offsets, h64_encode_2_offsets, h64_encode_1_offset, generate_h64_salt, validate_h64_salt + h64_encode_3_offsets, h64_encode_2_offsets, h64_encode_1_offset, generate_h64_salt, validate_h64_salt #pkg #local __all__ = [ diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index d3efb1a..97f0b15 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -30,7 +30,6 @@ __all__ = [ "xor_bytes", #hash64 encoding - 'h64_gensalt', 'h64_validate', ] #================================================================================= @@ -193,21 +192,6 @@ def xor_bytes(left, right): #================================================================================= #misc #================================================================================= -class HashInfo(object): - "helper used internally by various CryptAlgorithm implementations to store parsed results" - ident = None #identifier portion of hash - salt = None #salt portion of hash - checksum = None #checksum (result of hashing salt & password according to alg) - rounds = None #number of rounds, if known & applicable - source = None #source above information was parsed from, if available - - def __init__(self, ident, salt, checksum=None, rounds=None, source=None): - self.ident = ident - self.salt = salt - self.checksum = checksum - self.rounds = rounds - self.source = source - def norm_rounds(value, default, presets): """helper for validating & normalizing hash 'rounds' parameter """ @@ -308,8 +292,6 @@ def generate_h64_salt(count): "return base64 salt containing specified number of characters" return getrandstr(salt_rng, H64_CHARS, count) -h64_gensalt = gen_h64_salt - def validate_h64_salt(value, count): "validate base64 encoded salt is of right size & charset" if len(value) != count: |
