summaryrefslogtreecommitdiff
path: root/passlib/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/handlers')
-rw-r--r--passlib/handlers/bcrypt.py5
-rw-r--r--passlib/handlers/digests.py3
-rw-r--r--passlib/handlers/django.py5
-rw-r--r--passlib/handlers/mysql.py5
-rw-r--r--passlib/handlers/oracle.py3
-rw-r--r--passlib/handlers/postgres.py3
6 files changed, 9 insertions, 15 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py
index 0a277e1..1c51924 100644
--- a/passlib/handlers/bcrypt.py
+++ b/passlib/handlers/bcrypt.py
@@ -29,7 +29,6 @@ from passlib.utils import safe_crypt, repeat_string, to_bytes, parse_version, \
rng, getrandstr, test_crypt, to_unicode, \
utf8_truncate, utf8_repeat_string, crypt_accepts_bytes
from passlib.utils.binary import bcrypt64
-from passlib.utils.compat import str_to_uascii
import passlib.utils.handlers as uh
# local
@@ -688,7 +687,7 @@ class _BcryptorBackend(_BcryptCommon):
hash = _bcryptor.engine.Engine(False).hash_key(secret, config)
if not hash.startswith(config) or len(hash) != len(config) + 31:
raise uh.exc.CryptBackendError(self, config, hash, source="bcryptor library")
- return str_to_uascii(hash[-31:])
+ return hash[-31:]
#-----------------------------------------------------------------------
# pybcrypt backend
@@ -756,7 +755,7 @@ class _PyBcryptBackend(_BcryptCommon):
hash = _pybcrypt.hashpw(secret, config)
if not hash.startswith(config) or len(hash) != len(config) + 31:
raise uh.exc.CryptBackendError(self, config, hash, source="pybcrypt library")
- return str_to_uascii(hash[-31:])
+ return hash[-31:]
_calc_checksum = _calc_checksum_raw
diff --git a/passlib/handlers/digests.py b/passlib/handlers/digests.py
index a7add53..d9bf283 100644
--- a/passlib/handlers/digests.py
+++ b/passlib/handlers/digests.py
@@ -9,7 +9,6 @@ import logging; log = logging.getLogger(__name__)
# site
# pkg
from passlib.utils import to_native_str, to_bytes, render_bytes, consteq
-from passlib.utils.compat import str_to_uascii
import passlib.utils.handlers as uh
from passlib.crypto.digest import lookup_hash
# local
@@ -47,7 +46,7 @@ class HexDigestHash(uh.StaticHandler):
def _calc_checksum(self, secret):
if isinstance(secret, str):
secret = secret.encode("utf-8")
- return str_to_uascii(self._hash_func(secret).hexdigest())
+ return self._hash_func(secret).hexdigest()
#===================================================================
# eoc
diff --git a/passlib/handlers/django.py b/passlib/handlers/django.py
index e8cc0ba..95d1a13 100644
--- a/passlib/handlers/django.py
+++ b/passlib/handlers/django.py
@@ -13,7 +13,6 @@ from passlib.handlers.bcrypt import _wrapped_bcrypt
from passlib.hash import argon2, bcrypt, pbkdf2_sha1, pbkdf2_sha256
from passlib.utils import to_unicode, rng, getrandstr
from passlib.utils.binary import BASE64_CHARS
-from passlib.utils.compat import str_to_uascii
from passlib.crypto.digest import pbkdf2_hmac
import passlib.utils.handlers as uh
# local
@@ -121,7 +120,7 @@ class django_salted_sha1(DjangoSaltedHash):
def _calc_checksum(self, secret):
if isinstance(secret, str):
secret = secret.encode("utf-8")
- return str_to_uascii(sha1(self.salt.encode("ascii") + secret).hexdigest())
+ return sha1(self.salt.encode("ascii") + secret).hexdigest()
class django_salted_md5(DjangoSaltedHash):
"""This class implements Django's Salted MD5 hash, and follows the :ref:`password-hash-api`.
@@ -159,7 +158,7 @@ class django_salted_md5(DjangoSaltedHash):
def _calc_checksum(self, secret):
if isinstance(secret, str):
secret = secret.encode("utf-8")
- return str_to_uascii(md5(self.salt.encode("ascii") + secret).hexdigest())
+ return md5(self.salt.encode("ascii") + secret).hexdigest()
#=============================================================================
# BCrypt
diff --git a/passlib/handlers/mysql.py b/passlib/handlers/mysql.py
index e8aa4ef..61c23dc 100644
--- a/passlib/handlers/mysql.py
+++ b/passlib/handlers/mysql.py
@@ -30,8 +30,7 @@ from warnings import warn
# site
# pkg
from passlib.utils import to_native_str
-from passlib.utils.compat import bascii_to_str, \
- byte_elem_value, str_to_uascii
+from passlib.utils.compat import byte_elem_value
import passlib.utils.handlers as uh
# local
__all__ = [
@@ -117,7 +116,7 @@ class mysql41(uh.StaticHandler):
# FIXME: no idea if mysql has a policy about handling unicode passwords
if isinstance(secret, str):
secret = secret.encode("utf-8")
- return str_to_uascii(sha1(sha1(secret).digest()).hexdigest()).upper()
+ return sha1(sha1(secret).digest()).hexdigest().upper()
#===================================================================
# eoc
diff --git a/passlib/handlers/oracle.py b/passlib/handlers/oracle.py
index 8cd01e4..92f1767 100644
--- a/passlib/handlers/oracle.py
+++ b/passlib/handlers/oracle.py
@@ -10,7 +10,6 @@ import logging; log = logging.getLogger(__name__)
# site
# pkg
from passlib.utils import to_unicode, xor_bytes
-from passlib.utils.compat import str_to_uascii
from passlib.crypto.des import des_encrypt_block
import passlib.utils.handlers as uh
# local
@@ -160,7 +159,7 @@ class oracle11(uh.HasSalt, uh.GenericHandler):
if isinstance(secret, str):
secret = secret.encode("utf-8")
chk = sha1(secret + unhexlify(self.salt.encode("ascii"))).hexdigest()
- return str_to_uascii(chk).upper()
+ return chk.upper()
#===================================================================
# eoc
diff --git a/passlib/handlers/postgres.py b/passlib/handlers/postgres.py
index aead4c1..abe7663 100644
--- a/passlib/handlers/postgres.py
+++ b/passlib/handlers/postgres.py
@@ -8,7 +8,6 @@ import logging; log = logging.getLogger(__name__)
# site
# pkg
from passlib.utils import to_bytes
-from passlib.utils.compat import str_to_uascii
import passlib.utils.handlers as uh
# local
__all__ = [
@@ -44,7 +43,7 @@ class postgres_md5(uh.HasUserContext, uh.StaticHandler):
if isinstance(secret, str):
secret = secret.encode("utf-8")
user = to_bytes(self.user, "utf-8", param="user")
- return str_to_uascii(md5(secret + user).hexdigest())
+ return md5(secret + user).hexdigest()
#===================================================================
# eoc