Is there a practical difference between generate bcrypt salt and hash on separate function calls or auto-gen a salt and hash?

I honestly tried my best to find the answer here or anywhere else.
Bcrypt documentation states that there are 2 techniques to hash/salt a password:
Technique 1 (generate a salt and hash on separate function calls):

bcrypt.genSalt(saltRounds, function(err, salt) {
    bcrypt.hash(myPlaintextPassword, salt, function(err, hash) {
        // Store hash in your password DB.
    });
});

And technique 2 (auto-gen a salt and hash):

bcrypt.hash(myPlaintextPassword, saltRounds, function(err, hash) {
    // Store hash in your password DB.
});

Note that both techniques achieve the same end-result…

If they do, why do we need to add extra lines of code?
Is it just esthetical preference? Or is there any practical reason?

Thank you!

18 thoughts on “Is there a practical difference between generate bcrypt salt and hash on separate function calls or auto-gen a salt and hash?”

  1. Hey! Someone in my Myspace group shared this site with us so I came to take a look.
    I’m definitely loving the information. I’m bookmarking and
    will be tweeting this to my followers! Wonderful blog and fantastic style and design.

    Feel free to surf to my blog; weed near me

    Reply

Leave a Comment