diff options
Diffstat (limited to 'passlib/handlers/phpass.py')
-rw-r--r-- | passlib/handlers/phpass.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/passlib/handlers/phpass.py b/passlib/handlers/phpass.py index 6736f0f..102f9de 100644 --- a/passlib/handlers/phpass.py +++ b/passlib/handlers/phpass.py @@ -14,7 +14,6 @@ import logging; log = logging.getLogger(__name__) # site # pkg from passlib.utils.binary import h64 -from passlib.utils.compat import u, uascii_to_str, unicode import passlib.utils.handlers as uh # local __all__ = [ @@ -79,9 +78,9 @@ class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): rounds_cost = "log2" #--HasManyIdents-- - default_ident = u("$P$") - ident_values = (u("$P$"), u("$H$")) - ident_aliases = {u("P"):u("$P$"), u("H"):u("$H$")} + default_ident = u"$P$" + ident_values = (u"$P$", u"$H$") + ident_aliases = {u"P":u"$P$", u"H":u"$H$"} #=================================================================== # formatting @@ -105,18 +104,18 @@ class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): ) def to_string(self): - hash = u("%s%s%s%s") % (self.ident, + hash = u"%s%s%s%s" % (self.ident, h64.encode_int6(self.rounds).decode("ascii"), self.salt, - self.checksum or u('')) - return uascii_to_str(hash) + self.checksum or u'') + return hash #=================================================================== # backend #=================================================================== def _calc_checksum(self, secret): # FIXME: can't find definitive policy on how phpass handles non-ascii. - if isinstance(secret, unicode): + if isinstance(secret, str): secret = secret.encode("utf-8") real_rounds = 1<<self.rounds result = md5(self.salt.encode("ascii") + secret).digest() |