Robin Singh
Robin Singh

Reputation: 1

Decrypt the password in mongoose

How to decrypt any encrypted password in nodeJS using mongoose?

       `bcrypt.genSalt(5, (err, Salt) => {
    bcrypt.hash(this.password, Salt, (err, hash) => {
        if(err) {
            console.log('Error in generating salt: ' + err)
        }
        else {
            this.password = hash
            this.saltString = Salt
            next()
        }
    })
})`

Upvotes: 0

Views: 874

Answers (2)

dan1st
dan1st

Reputation: 16457

TL;TR

No

Explaination

This password is hashed with a salt.

Hashes are made not to be decryptable.

There may even be multiple cleartexts(passwords) that give you the same hash(collisions).

Brute-force (try every possible password) won't help too because it takes very long(million years if you have a good password).

You may try to do a dictionary attack (try words from a dictionary with a few changes) but this won't work if the password is random or e.g. contains multiple/rare words).

In order to avoid that the same password for a username(or anything like that), salts are added that make decryption even more difficult.

Bcrypt can not be cracked until now.

Upvotes: 0

Sanket Phansekar
Sanket Phansekar

Reputation: 741

No, its not possible.

  • Bcrypt is one way hashing algorithm.
  • It's not possible to decrypt the password in bcrypt.
  • You can hash your password again with the same salt and compare the hashes.

Upvotes: 1

Related Questions