Bcrypt.checkpw возвращает TypeError: объекты Unicode должны быть закодированы перед проверкойPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Bcrypt.checkpw возвращает TypeError: объекты Unicode должны быть закодированы перед проверкой

Сообщение Anonymous »


I am calling bcrypt.checkpw to check unencrypted password matches with hashed password stored in the credential database, but receive

TypeError: Unicode-objects must be encoded before checking

How should I resolve this issue? Any suggestion?
I installed python 2.7.6, and bcrypt 3.1.1

I have the following code:

def check_password(password, hashed_password) if not bcrypt.checkpw(password, hashed_password): raise InvalidCredentials("403 Forbidden") else: return true And receive the following error:

File "/home/qt/virtualenv/lib/python2.7/site-packages/bcrypt/init.py", line 100, in checkpw
raise TypeError("Unicoed-objects must be encoded before checking")
TypeError: Unicode-objects must be encoded before checking

I looked into bcrypt/__init__.py, but I'm not sure why
def checkpw(password, hashed_password): if (isinstance(password, six.text_type) or isinstance(hashed_password, six.text_type)): raise TypeError("Unicode-objects must be encoded before checking")

Источник: https://stackoverflow.com/questions/405 ... re-checkin
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»