Bcrypt Tutorial in Nodejs | Understand Hashing, Salt, Rainbow Tables and Bcrypt

  Рет қаралды 16,391

Coding With Chaim

Coding With Chaim

3 жыл бұрын

What is the safest way to store a user's password in the database? Did you guess hashing? If you did then you would be correct. Hashing with a salt, and using a slow running algo like bcrypt is the safest way to go about storing a user's password in the db. In this video I demonstrate how to use bcryptjs to do just that.
Get 1 on 1 mentorship with me! ▶▶▶calendly.com/codingwithchaim/...

Пікірлер: 102
@visheshpandey2001
@visheshpandey2001 3 ай бұрын
no whiteboard , no diagram, no presentation, no animation just code and straight talk at 2x and yes we all understood.Thnak you for such nice explanation
@sarunluitel2001
@sarunluitel2001 3 жыл бұрын
Finally!! Thank You!. I was loosing my mind thinking how bcrypt knows what salt was used when comparing. now I know
@sarunluitel2001
@sarunluitel2001 3 жыл бұрын
Apparently there is also the concept of peppers (a fixed value stored in the server to append to each password) on top of salt. Are there anything else used in the modern day "best practices"?
@dontqsy5101
@dontqsy5101 2 жыл бұрын
Can someone explain me how bcrypt works (especially when we are comparing a hash with a text plain password ) ? I dont speak english, i cant undrestand the video
@odiltoxtaboyev7599
@odiltoxtaboyev7599 Жыл бұрын
@@dontqsy5101 14:52
@aaronmartin56
@aaronmartin56 2 жыл бұрын
This might be the single best programming video on KZbin...
@ty.udy_
@ty.udy_ 3 жыл бұрын
Wow, you just explain an entire 2 weeks of my college security course in 17 minutes. Thank you much, sir
@TheCodingOdyssey
@TheCodingOdyssey 3 жыл бұрын
Love this explanation. Not only you explained the how, but the why. A lot of times we are working with stuff, but we don't really understand the behind the scenes. This explains it in case of what bycript does for us.
@wuwo2296
@wuwo2296 4 ай бұрын
Fine job explaining bcrypt! You answered all the burning questions I had about how this works! Thank you and keep sharing!
@SakosTechSpot
@SakosTechSpot 10 ай бұрын
Great video! Explained everything I wanted to know. Had to watch at 0.75x speed though cause I couldn't keep up lol
@alexgregory5583
@alexgregory5583 3 жыл бұрын
Oh man, every single question I had about bcrypt and salts was answered in this video! Really appreciate walking through from bad to best practice and explaining why each step is better than the previous.
@Webdevelopmentya
@Webdevelopmentya Жыл бұрын
lol was definitely a lot to follow and keep up with but this was exactly what I needed . I wanted to figure out a way to use compare and check the user password and hash password to log a user in but since I love to learn how things work and the process I stumbled upon this video. I got a full understanding how Hashing and Salt works and the answer to my problem. Thank you soooo much !!
@thecyrusj13
@thecyrusj13 2 жыл бұрын
This is the first explanation I've heard that I can actually understand. Most of the time people abbreviate the hard parts or give an answer that's too complicated to pick apart. Thanks for the video.
@muhammadumer4127
@muhammadumer4127 Жыл бұрын
The best explanation, every single question I had about bcrypt and salts was answered in this video. Thankyou
@radi_dev7628
@radi_dev7628 2 жыл бұрын
Now this is the best explanation I've gotten on the subject. And you talk fast too. Awesome. I'm subscribing right away
@patrickkranzpiller6400
@patrickkranzpiller6400 2 жыл бұрын
Fantastic explanation, especially on the comparing of existing hashes which is the part I was confused about. Thank you!
@dhillaz
@dhillaz 2 жыл бұрын
Thanks, 14:52 is the explanation I was looking for - the output bcrypt creates contains both the hash and the salt concatenated (plus the number of salting rounds), therefore there is no need to store the salt separately when building an application.
@steamerSama
@steamerSama 3 ай бұрын
yep, me too!!
@MsFarria
@MsFarria 2 жыл бұрын
Awesome, Awesome explanation! Clarified everything. Exactly what i was looking for!!! Thanks!!
@godspower3183
@godspower3183 Жыл бұрын
Had to hit the like and subscribe button. This was masterfully done. Thank you very much.
@tapank415
@tapank415 2 жыл бұрын
last part is video is what i was looking for. Awesome explanation! ! !
@DanMazzilli-pv9yl
@DanMazzilli-pv9yl Жыл бұрын
Awesome video! Clear explanation! Thank you so much
@souvikchakraborty9900
@souvikchakraborty9900 11 ай бұрын
Thanks sir you really explained it well and with every ounce of knowledge. I really appreciate your work and really wish if teachers at my university would have been like you.
@jamalwebdevelopment4841
@jamalwebdevelopment4841 2 жыл бұрын
You are the real gem we need in this world😍
@hemantvardani1436
@hemantvardani1436 2 жыл бұрын
Hey !! what a amazing viedo !!! Really man, that was full of knowledge ...Thanks
@AdityaGupta-yi7oe
@AdityaGupta-yi7oe 2 ай бұрын
So basically, Hacker can still get access to the salt and the hashes and figure out the password but he would have to create his own rainbow table for that specific salt which would be infeasible for him. Thankyou for the explanation!!
@adarshchakraborty
@adarshchakraborty 3 жыл бұрын
Exactly, I had this question in my mind, thank you for answering
@skygolden7293
@skygolden7293 Жыл бұрын
Really well explained. Great video, thanks 🙏
@englishaccount4016
@englishaccount4016 2 жыл бұрын
this so amazing you deserve a lot of suscribers
@jonahg6564
@jonahg6564 3 жыл бұрын
Thank you for actually explaining what it is!
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
Pleasure
@EnglishRain
@EnglishRain Жыл бұрын
Excellent explanation thanks a ton!
@jermaineblake8671
@jermaineblake8671 2 жыл бұрын
Very helpful explanation. Thank You!
@sanjitselvan5348
@sanjitselvan5348 2 жыл бұрын
Good explanation. Thanks!
@jacobcambell
@jacobcambell 2 жыл бұрын
Explained very well with no BS thanks
@CSERohitKartik
@CSERohitKartik 2 жыл бұрын
Well explained, Chaim so good :)
@divyarao3387
@divyarao3387 2 жыл бұрын
Amazing explanation . Thank you so much!
@davidmaccarthy3922
@davidmaccarthy3922 3 жыл бұрын
Awesome, Awesome explanation! Clarified everything. Thanks!!
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
You are most welcome!
@faizanahmed9304
@faizanahmed9304 3 жыл бұрын
Great explanation, just loved it
@updatedotexe
@updatedotexe 3 жыл бұрын
Best explanation I have yet seen.
@ChaseNorton
@ChaseNorton Жыл бұрын
Well done - great video
@ellsonmendesYT
@ellsonmendesYT 3 жыл бұрын
excellent video, got rid off all my doubts
@matheusleal9333
@matheusleal9333 2 жыл бұрын
Amazing Stuff!!
@orelalon6167
@orelalon6167 3 жыл бұрын
Excellent explanation!
@utkarshsingh2598
@utkarshsingh2598 3 жыл бұрын
Sir really thanks for explaining this
@dror-krief
@dror-krief Жыл бұрын
היי תודה לך ממש מגניב שמצאתי את הערוץ שלך thank you so much it's very useful
@danielbetancourt5941
@danielbetancourt5941 3 жыл бұрын
Great explanation. Thank you
@djneils100
@djneils100 3 жыл бұрын
thanks for really interesting video Chaim!
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
You’re welcome!
@abhirammenon9676
@abhirammenon9676 2 жыл бұрын
great content man...
@JDesrosiers
@JDesrosiers 3 жыл бұрын
Thanks a lot for this.
@TheAboutTown
@TheAboutTown 3 жыл бұрын
thanks for this great video. I have a couple of questions. Is the salt also stored in the database somewhere? Or is it always some fixed length, say n, and the comparison is made without the last n characters in the hash with the salt? In other words, how is the salt removed? Also why do the salts in this video always start with a$10$?
@Abdullah-uv9nk
@Abdullah-uv9nk 3 жыл бұрын
Amazing explanation, thank you sir
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
You’re most welcome!
@wandavazquez3201
@wandavazquez3201 2 жыл бұрын
excellent presentation. very clarifying what happens when someone forgets their password?
@arnabchatterjee2094
@arnabchatterjee2094 2 жыл бұрын
u r a gr8 teacher
@dafaaqilla5185
@dafaaqilla5185 Жыл бұрын
Thanksalot sir!
@Codebrah
@Codebrah Жыл бұрын
Only thing I don't understand is why we even bother with the salt if we append it to the hashed password and then store it in the DB... is it because the hackers won't know the length of the salt? Or is it because any random salt at all makes the rainbow table useless? Regardless, very good tutorial. You explain things well.
@shin-ishikiri-no
@shin-ishikiri-no 2 жыл бұрын
Incredible.
@aliyanhussain4649
@aliyanhussain4649 2 жыл бұрын
Don't know how to thank you for this video.
@CodingWithChaim
@CodingWithChaim 2 жыл бұрын
Glad it helped
@ahmedsherif7505
@ahmedsherif7505 2 жыл бұрын
you are amazing
@giovanniritchie
@giovanniritchie 5 ай бұрын
Thanks!
@ty.udy_
@ty.udy_ 3 жыл бұрын
So theoretically, if a hacker got access to your database, couldn't they make a rainbow table out of the normal passwords hashed with the first 27 characters of your stored password (aka your salt)? Or is the idea that that takes so long that it isn't feasible?
@miguelrohv5643
@miguelrohv5643 2 жыл бұрын
Hello, this is the only video that i got to understand bcrpyt. thank you for that. i have a question. does this mean i'll have to pull the hash from the database then compare it back in nodeJS?
@CodingWithChaim
@CodingWithChaim 2 жыл бұрын
correct
@hououinkyouma5372
@hououinkyouma5372 2 жыл бұрын
Thank you
@sunilpoojari91
@sunilpoojari91 2 жыл бұрын
You mentioned while comparing the password bcrypt take the salt out from the hash stored in the database and attaches it to the password that user has entered and then creates the hash for comparing both the has one present in the database and one that user has entered, but how does bcrypt know what is the start index and the end index of the salt to get the salt out of the hash i.e. stored in the database.
@CodingWithChaim
@CodingWithChaim 2 жыл бұрын
Bcrypt is the one that appends the salt to the hash so they know where it is
@CyberShark97
@CyberShark97 3 жыл бұрын
Very complete, clear and answered all of my questions. Exemplary video. If I may, why did you opt for bcryptjs over bcrypt? For the lack of dependencies?
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
Thank you! Honestly I cant remember the exact reason why I chose the js version here in this video, but typically in a real project, going with the JS version does make things simpler. I had an instance where I was trying to deploy code to AWS lambda with the non JS version and it was giving me major issues.
@CyberShark97
@CyberShark97 3 жыл бұрын
@@CodingWithChaim I’ll go for the js version then ahah, thanks again! Have a nice day :] (you got a new sub btw)
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
Thank you! Welcome to the channel
@lassesekopaa9202
@lassesekopaa9202 3 жыл бұрын
This may be stupid question, but if the salt that has been used is stored in the DB why can't the hackers just use that information to run through the common passwords. Is this unavoidable and this is just a way to make it more time comsuming for the hackers?
@roronoa_d_law1075
@roronoa_d_law1075 2 жыл бұрын
On point
@juanmanuelgallego3630
@juanmanuelgallego3630 3 жыл бұрын
Thank you.
@ravinakumari8007
@ravinakumari8007 2 жыл бұрын
Thank you so much for this video, my 80% confusion is clear now but I am still having doubts about the hacker's technique, can't they use the same bcrypt method and apply their RANMBOW thing on it while logging in? but many things are clear with your video thanks a lot:)
@ahmedgameel7377
@ahmedgameel7377 3 жыл бұрын
Iam shocked this video only has 2k views !
@odiltoxtaboyev7599
@odiltoxtaboyev7599 Жыл бұрын
14:52 Thank you!!!
@puneetsingh9678
@puneetsingh9678 3 жыл бұрын
bcrypt should be used in the frontend and then the hash should pass through network and stored in the db right?
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
No. The password is sent in plain text to the server and then hashed on the server.
@designer5445
@designer5445 10 ай бұрын
thanks
@alexsinx
@alexsinx 2 жыл бұрын
So if I get it right if the hacker knows where the salt begins and where it ends (since bcrypt is an open source package) we're back to the initial spot where they can just use the rainbow tables again, right?
@CodingWithChaim
@CodingWithChaim 2 жыл бұрын
No because the salt is totally random and is hashed.
@alexsinx
@alexsinx 2 жыл бұрын
@@CodingWithChaim but we can see on bcrypt repo that the salt has 16 chars and that the stored password will be the sequence of salt+password so the hacker doesnt need to "crack" the salt hash, they just need to take it off. Am I missurderstanding something?
@CodingWithChaim
@CodingWithChaim 2 жыл бұрын
@@alexsinx the salt gets added to the user’s password and then the combined string gets hashed. This means the resulting hash will not show up in a rainbow table
@mykhailosichkaruk
@mykhailosichkaruk 2 жыл бұрын
Seems reasonable to me too. If a hacker knows the hash() function and salt, he still can create rainbow tables. It should look like this: rainbow table = "salt "+ hash( "salt" + "popular_password") But hacker need to create a new table for every "salt".
@kshetritej_
@kshetritej_ 5 ай бұрын
stat from 13:30 for the comparing scenario
@micha1346
@micha1346 2 жыл бұрын
Great explanation! But talking a bit slower would make it even more perfect ;)
@trm8985
@trm8985 Жыл бұрын
😳
@JFKTLA
@JFKTLA Жыл бұрын
in just 17 mins i got a cyber security degree, lol jk i don't think its this simple XD.
@utkarshkukreti239
@utkarshkukreti239 3 жыл бұрын
It's practically infeasible to go back to the value from a cryptographic hash
@davidbrown7159
@davidbrown7159 2 жыл бұрын
Lechaim
@yourfavouriteman
@yourfavouriteman Жыл бұрын
I am completly dizzy !
@siddhantraj5323
@siddhantraj5323 Жыл бұрын
you really speak very fast
@kshetritej_
@kshetritej_ 5 ай бұрын
Andrew Tate must have learned from him.
@sleepingowl5037
@sleepingowl5037 2 жыл бұрын
Speaking very fast
@jorims8537
@jorims8537 Жыл бұрын
bro you talk faster than eminem. Calm down please.
@dalandan8300
@dalandan8300 Жыл бұрын
you talk too much
@davidmaccarthy3922
@davidmaccarthy3922 3 жыл бұрын
Awesome, Awesome explanation! Clarified everything. Thanks!!
@CodingWithChaim
@CodingWithChaim 3 жыл бұрын
You are most welcome!
Password Storage Tier List: encryption, hashing, salting, bcrypt, and beyond
10:16
The Key to Understanding React: Why Keys Matter
6:50
Coding With Chaim
Рет қаралды 8 М.
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 53 МЛН
WHAT’S THAT?
00:27
Natan por Aí
Рет қаралды 13 МЛН
Speed Up Your Node App Using Worker Threads!
6:34
Coding With Chaim
Рет қаралды 22 М.
What is an ORM and what does it do?
8:49
Code With Bubb
Рет қаралды 578
Hashing Passwords in Node and Express using bcrypt
17:38
Sam Meech-Ward
Рет қаралды 26 М.
Adding Salt to Hashing: A Better Way to Store Passwords
18:18
What Are Database Migrations? | Database Migrations in Node
10:34
Coding With Chaim
Рет қаралды 24 М.
Salting, peppering, and hashing passwords
8:56
mCoding
Рет қаралды 67 М.
Upload Files Nodejs | Upload Files in Nodejs Using Multer
19:39
Coding With Chaim
Рет қаралды 10 М.
Going Beyond Peer To Peer With WebRTC (Mesh, MCU, SFU)
6:16
Coding With Chaim
Рет қаралды 12 М.
PhD AI student explains how China already have won in AI..
13:28
livinlavidaluke
Рет қаралды 44 М.
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 2 МЛН
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 905 М.
Копия iPhone с WildBerries
1:00
Wylsacom
Рет қаралды 485 М.