I am saving my password after hashing using bcrypt
Now I need to get raw data from hash value.
suppose,
My password 123456. I am saving the password after hash suppose 3jhjhjkjk34k34k34j
I need to get my password from the hash value.
I am saving my password after hashing using bcrypt
Now I need to get raw data from hash value.
suppose,
My password 123456. I am saving the password after hash suppose 3jhjhjkjk34k34k34j
I need to get my password from the hash value.
You don't decrypt passwords with bcrypt because it's a one-way algorithm. What you can do is provide the plaintext and the hash (from the database) and compare.
Example:
const passwordEnteredByUser = "123456"
const hash = "HASH_STRING"
bcrypt.compare(passwordEnteredByUser, hash, function(err, isMatch) {
if (err) {
throw err
} else if (!isMatch) {
console.log("Password doesn't match!")
} else {
console.log("Password matches!")
}
})