Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid salt #9

Closed
adsahay opened this issue Apr 18, 2012 · 3 comments
Closed

Error: Invalid salt #9

adsahay opened this issue Apr 18, 2012 · 3 comments

Comments

@adsahay
Copy link

adsahay commented Apr 18, 2012

I'm using this extension for simple password encryption and matching. I use generate_password_hash and save the encrypted password in the database when creating a new user.

When trying to login this user, check_password_hash(password, db_user_password) throws an Invalid salt exception. I don't know how to debug this. Any help?

Could there be an encoding issue somewhere? I don't know a thing about encryption except generating and matching hashes, help would be appreciated.

@adsahay adsahay closed this as completed Apr 18, 2012
@adsahay
Copy link
Author

adsahay commented Apr 18, 2012

Sorry this is a non-issue, just needed to swap the order of parameters of check_password_hash. Stupid me.

@maxcountryman
Copy link
Owner

Hi,

You may need to encode the candidate password, i.e. the password to be checked, before running check_password_hash if you're using unicode.

Here's an example: https://github.com/maxcountryman/flask-bcrypt/blob/master/test_bcrypt.py#L40

Basically what you want to do is password.encode('utf-8') which will produce '\xe2\x98\x83'.

Hope that helps!

@maxcountryman
Copy link
Owner

Okay, good to know. 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants