Information Security with HelmetJS - Hash and Compare Passwords Synchronously

Tell us what’s happening:

I’m pretty sure i’m doing this correctly, but fCC won’t pass it. The hash prints to the console and the result does too (true). I get no errors in the console. Am I doing something wrong?

//START_SYNC

var hash = bcrypt.hashSync(myPlaintextPassword, saltRounds);
console.log(hash);
var res = bcrypt.compareSync(myPlaintextPassword, hash);
console.log(res);

//END_SYNC

Your project link(s)

solution: boilerplate-bcrypt - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Information Security with HelmetJS - Hash and Compare Passwords Synchronously

The variable has to be named result not res.

What’s cool about variables is that they can be named whatever you want.

It needs to be named that because of how it is tested.

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md

1 Like