summaryrefslogtreecommitdiff
path: root/passlib/handlers/md5_crypt.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-04-17 23:14:51 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-04-17 23:14:51 -0400
commit64ab6fc89b497efa9169f11d55251e417c4db0ba (patch)
treeb3f6f5dc27b87a6bc90cb3686fa98239ee8ff053 /passlib/handlers/md5_crypt.py
parent8eb4c4d3b58eec6802c698ddbf357b2fd243a68c (diff)
parentcd029846fdc0c3d7ffc7f53caad4579e7e0e8725 (diff)
downloadpasslib-ironpython-support-dev.tar.gz
Merge from defaultironpython-support-dev
Diffstat (limited to 'passlib/handlers/md5_crypt.py')
-rw-r--r--passlib/handlers/md5_crypt.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/passlib/handlers/md5_crypt.py b/passlib/handlers/md5_crypt.py
index 9441bbc..c963155 100644
--- a/passlib/handlers/md5_crypt.py
+++ b/passlib/handlers/md5_crypt.py
@@ -68,14 +68,13 @@ def _raw_md5_crypt(pwd, salt, use_apr=False):
#=====================================================================
#validate secret
+ # XXX: not sure what official unicode policy is, using this as default
if isinstance(pwd, unicode):
- # XXX: not sure what official unicode policy is, using this as default
pwd = pwd.encode("utf-8")
- elif not isinstance(pwd, bytes):
- raise TypeError("password must be bytes or unicode")
+ assert isinstance(pwd, bytes), "pwd not unicode or bytes"
pwd_len = len(pwd)
- #validate salt
+ #validate salt - should have been taken care of by caller
assert isinstance(salt, unicode), "salt not unicode"
salt = salt.encode("ascii")
assert len(salt) < 9, "salt too large"