Skip to content

Commit af459e6

Browse files
authored
Support encoded passwords & hashes
1 parent 4f8b9ac commit af459e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

simplebcrypt.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ def bhash(password):
1212
except:
1313
return None
1414
def verify(password,hashed):
15+
if type(password) == bytes:
16+
password = password.decode()
17+
if type(hashed) == bytes:
18+
hashed = hashed.decode()
19+
if type(password) != str or type(hashed) != str:
20+
raise Exception("Wrong password type: Expected string")
1521
if len(password) > 72:
1622
raise Exception("Password is above max length of 72")
1723
try:

0 commit comments

Comments
 (0)