Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Introducing the Practice2:00 with Alena Holligan
This video introduces the challenge that you'll be working to complete.
NPM Bcrypt Package — Try using hashSync(data, salt) and compareSync(data, encrypted)
Hey everyone, Alena here.
Practice is vital to becoming a proficient developer.
It solidifies what you've learned causing it to stick in your memory.
With deliberate practice,
it becomes quicker and easier to solve the challenges that you'll face everyday.
This session covers hashing passwords with bcrypt.
This practice session is intended to follow the introduction to
If you haven't taken that course already, make sure you jump over and
view all the important information that course covers.
There are links to additional courses in the notes attached to this video.
I've started you out with a couple of constants which you'll be using for
SaltRounds will be used for hashing the string, and
original hash will be used to compare against a hashed value.
Step 1, install and include the bscript npm package.
Step 2, hash the string 'password' and display it to the screen.
Step 3, hash the string 'bad_password' and display that to the screen as well.
Step 4, use the bcrypt package
to compare the string 'password' with the variable originalHash.
Step 5, use the bcrypt package
to compare the string 'bad_password' with the variable originalHash.
It's okay to make multiple attempts before coming to a solution.
That struggle to remember what you've learned and
apply it to the situation is what causes the knowledge to take root.
If you do get stuck,
I've included additional resources in the notes associated with this video.
Go ahead and give it a try, and I'll show you my solution in the next video.
You need to sign up for Treehouse in order to download course files.Sign up