SALT and HASH password in nodejs w/ crypto

前端 未结 7 2231
野趣味
野趣味 2020-12-07 18:43

I am trying to figure out how to salt and hash a password in nodejs using the crypto module. I am able to create the hashed password doing this:

UserSchema.         


        
7条回答
  •  清歌不尽
    2020-12-07 19:41

    Faced with the same question I brought everything together into one module: https://www.npmjs.org/package/password-hash-and-salt

    It uses pbkdf2 and stores hash, salt, algorithm, and iterations in a single field. Hope it helps.

提交回复
热议问题