Skip to content

Migrate from bcrypt

Simone Primarosa edited this page Sep 7, 2017 · 1 revision

Let's users be your collection of registered users. Each of those users should have the hash computed with bcrypt stored somewhere. We will assume that this was stored in bcrypt property of each user.

users.forEach(user => {
  var hash = JSON.stringify({
    hash: user.bcrypt,
    func: 'bcrypt'
  });
  user.hash = hash;  // Now you can pass user.hash to the verify function of
                     // this package.
});
Clone this wiki locally