pyca / bcrypt

Modern(-ish) password hashing for your software and your servers
Apache License 2.0
1.23k stars 165 forks source link

TypeError in checkpw #768

Closed eddthelucky closed 6 months ago

eddthelucky commented 6 months ago

I ran into a type error when running bcrypt.checkpw(password, hashed_password). I generated a hashed password with bcrypt.hashpw(str.encode(password), bcrypt.gensalt(prefix=b"2b")) when password was 0.

TypeError: argument 'password': 'str' object cannot be converted into 'PyBytes'

Considering this worked with 3 and not 0 I'm guessing there's a bug?

alex commented 6 months ago

This error message indicates that you are passing a string where a bytes is required. To the best of my memory, passing bytes has always been a requirement of this API.

If you think you have a regression, please provide a minimal executable reproducer that works on one version of bcrypt and errors on another.