79644834

Date: 2025-05-30 03:07:40
Score: 0.5
Natty:
Report link

I just realized my issue. In order to compare the passwords, the first argument to checkpw() is a str converted into bytes. The second argument is also a str converted into bytes, but checkpw() must do something behind the scenes to remove the salt when it was generated.

match = bcrypt.checkpw(
    password_to_check.encode('utf-8'),
    user.password_hash.encode("utf-8")
)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Simon1