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)
[MUSIC] 0:00 Hey everyone, Alena here. 0:09 Practice is vital to becoming a proficient developer. 0:11 It solidifies what you've learned causing it to stick in your memory. 0:15 With deliberate practice, 0:19 it becomes quicker and easier to solve the challenges that you'll face everyday. 0:21 This session covers hashing passwords with bcrypt. 0:26 This practice session is intended to follow the introduction to 0:30 application security. 0:33 If you haven't taken that course already, make sure you jump over and 0:35 view all the important information that course covers. 0:39 There are links to additional courses in the notes attached to this video. 0:44 I've started you out with a couple of constants which you'll be using for 0:48 this challenge. 0:52 SaltRounds will be used for hashing the string, and 0:53 original hash will be used to compare against a hashed value. 0:57 Step 1, install and include the bscript npm package. 1:02 Step 2, hash the string 'password' and display it to the screen. 1:09 Step 3, hash the string 'bad_password' and display that to the screen as well. 1:14 Step 4, use the bcrypt package 1:21 to compare the string 'password' with the variable originalHash. 1:24 Step 5, use the bcrypt package 1:29 to compare the string 'bad_password' with the variable originalHash. 1:32 It's okay to make multiple attempts before coming to a solution. 1:37 That struggle to remember what you've learned and 1:42 apply it to the situation is what causes the knowledge to take root. 1:44 If you do get stuck, 1:49 I've included additional resources in the notes associated with this video. 1:51 Go ahead and give it a try, and I'll show you my solution in the next video. 1:55
You need to sign up for Treehouse in order to download course files.Sign up