“Bcrypt Nodejs Hash Passwort” Code-Antworten

Bcrypt Nodejs Hash Passwort

 bcrypt.genSalt(saltRounds, (err, salt) => {
    bcrypt.hash(yourPassword, salt, (err, hash) => {
       console.log(salt + hash)
    });
});
Uptight Unicorn

Bcrypt vergleiche Hash und Passwort


	var bcrypt = dcodeIO.bcrypt; 

    /** One way, can't decrypt but can compare */
    var salt = bcrypt.genSaltSync(10);

    /** Encrypt password */
    bcrypt.hash('anypassword', salt, (err, res) => {
        console.log('hash', res)
        hash = res
        compare(hash)
    });

    /** Compare stored password with new encrypted password */
    function compare(encrypted) {
        bcrypt.compare('aboveusedpassword', encrypted, (err, res) => {
            // res == true or res == false
            console.log('Compared result', res, hash) 
        })
    }

// If u want do the same with NodeJS use this:
/*		var bcrypt = require('bcryptjs')	*/
Sticky Pingu

Ähnliche Antworten wie “Bcrypt Nodejs Hash Passwort”

Fragen ähnlich wie “Bcrypt Nodejs Hash Passwort”

Weitere verwandte Antworten zu “Bcrypt Nodejs Hash Passwort” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen