-
Notifications
You must be signed in to change notification settings - Fork 525
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
bcrypt.compare() always return false even when it´s supposed to be true #1037
Comments
@s-pl yes i have been facing this issue as well with both bcryptjs and bcrypt |
any update, I got similar problem. |
//my solution!! |
// my solution |
I am using postgresSQL. But its not a concern here i guess. facing the same issue as above. will it help if i am using a saltRound of lower value? it obviously means reducing security. but i think the length of the hashed password generated is the problem here. what do you guys think? |
the common solution is to extend the maximum lenght of characters that your
db can handle. But if that doesn’t work try to install the previous version
of Bcrypt.
El El lun, 24 jun 2024 a las 13:11, Moonis Ahmed ***@***.***>
escribió:
… I am using postgresSQL. But its not a concern here i guess. facing the
same issue as above. will it help if i am using a saltRound of lower value?
it obviously means reducing security. but i think the length of the hashed
password generated is the problem here. what do you guys think?
—
Reply to this email directly, view it on GitHub
<#1037 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQNX64EOA4SG3JLTK4UR7QDZJAEG7AVCNFSM6AAAAABHSZDI2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGQZTCNZUGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Use this await user.updateOne({ $set: { password: hashedPassword } }); |
For me it was a logical error which is fixed now, bcrypt is working fine. |
Hello, I'm working on an authentication system in MongoDB. When storing passwords, everything seems fine:
{"_id":{"$oid":"66408f417315a786f0d1d279"},"username":"test","email":"[email protected]","password":"$2b$10$e2KuxFiAq4oVl7DaL80TX.9udp65K9uoiVOSfXZNmzHP8rVqIR5bG","role":"user","createdAt":{"$date":{"$numberLong":"1715507009424"}},"updatedAt":{"$date":{"$numberLong":"1715507009424"}},"__v":{"$numberInt":"0"}}
But then, when comparing the hash with the password, it always returns incorrect (even when it's correct). This is the method I'm using:
And this is the comparison log:
test $2b$10$e2KuxFiAq4oVl7DaL80TX.9udp65K9uoiVOSfXZNmzHP8rVqIR5bG
I think there's an error in the
bcrypt.compare
function, but I'm very lostThe text was updated successfully, but these errors were encountered: