Bcrypt error: illegal arguments String unidentified

后端 未结 8 2056
误落风尘
误落风尘 2021-01-17 10:49

here is my complete code

var express = require(\'express\'),
    app = express(),
    mongoose = require(\'mongoose\'),
    bodyParser = require(\'body-parse         


        
8条回答
  •  耶瑟儿~
    2021-01-17 11:16

    I also encountered the same error when I was using bcrypt.compareSync("input to be compared with the hash", hash).

    Later on I discovered that I was supposed to pass the actual value in the first input parameter i.e (The actual value from which the hash was generated) and the hash in the second input parameter, but I was passing hashed values in both the input parameters.

    After correcting the same it was giving me the desired output as true or false.

    You can also run and check your code here.

提交回复
热议问题