diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2016-06-20 16:52:22 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2016-06-20 16:52:22 -0400 |
commit | 47ce6180c802f03c4436cbbf7cfccf96d65626f4 (patch) | |
tree | acc634a6ceba76c70d32eec6ca4030dac3f375cc /passlib/utils/handlers.py | |
parent | a6b7045179294d3b8df215d40ba889b76c66620d (diff) | |
download | passlib-47ce6180c802f03c4436cbbf7cfccf96d65626f4.tar.gz |
scrypt: hash format changed
* tweaked passlib's format to follow argon2 and
use explicit param names + normal base64 encoding
* added support for openwall's $7$ format
* moved hash tests to separate file
Diffstat (limited to 'passlib/utils/handlers.py')
-rw-r--r-- | passlib/utils/handlers.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/passlib/utils/handlers.py b/passlib/utils/handlers.py index e34f8c6..cb45354 100644 --- a/passlib/utils/handlers.py +++ b/passlib/utils/handlers.py @@ -220,28 +220,28 @@ def parse_mc3(hash, prefix, sep=_UDOLLAR, rounds_base=10, # return result return rounds, salt, chk or None -def parse_mc3_long(hash, prefix, sep=_UDOLLAR, handler=None): - """ - parse hash using 3-part modular crypt format, - with complex settings string instead of simple rounds. - otherwise works same as :func:`parse_mc3` - """ - # detect prefix - hash = to_unicode(hash, "ascii", "hash") - assert isinstance(prefix, unicode) - if not hash.startswith(prefix): - raise exc.InvalidHashError(handler) - - # parse 3-part hash or 2-part config string - assert isinstance(sep, unicode) - parts = hash[len(prefix):].split(sep) - if len(parts) == 3: - return parts - elif len(parts) == 2: - settings, salt = parts - return settings, salt, None - else: - raise exc.MalformedHashError(handler) +# def parse_mc3_long(hash, prefix, sep=_UDOLLAR, handler=None): +# """ +# parse hash using 3-part modular crypt format, +# with complex settings string instead of simple rounds. +# otherwise works same as :func:`parse_mc3` +# """ +# # detect prefix +# hash = to_unicode(hash, "ascii", "hash") +# assert isinstance(prefix, unicode) +# if not hash.startswith(prefix): +# raise exc.InvalidHashError(handler) +# +# # parse 3-part hash or 2-part config string +# assert isinstance(sep, unicode) +# parts = hash[len(prefix):].split(sep) +# if len(parts) == 3: +# return parts +# elif len(parts) == 2: +# settings, salt = parts +# return settings, salt, None +# else: +# raise exc.MalformedHashError(handler) def parse_int(source, base=10, default=None, param="value", handler=None): """ @@ -1121,7 +1121,7 @@ class HasManyIdents(GenericHandler): @classmethod def identify(cls, hash): hash = to_unicode_for_identify(hash) - return any(hash.startswith(ident) for ident in cls.ident_values) + return hash.startswith(cls.ident_values) @classmethod def _parse_ident(cls, hash): |