Choosing the right password hashing algorithm is critical for security. In this video, we’ll compare Bcrypt and Argon2, two of the most popular hashing functions. We’ll break down their strengths, weaknesses, and real-world performance to help you decide which one is best for your application.
🔐 What You’ll Learn: ✔️ How Bcrypt works with examples ✔️ Why Bcrypt might not be the best option ✔️ Argon2 hashing explained with practical examples ✔️ Which one is better for security in 2025? ✔️ Final verdict – Bcrypt or Argon2?
By the end of this tutorial, you’ll have a clear understanding of which hashing function to use for maximum security in your applications.
⌛TIMELINE⏳ ⏳ 0:00 – Intro: Which Password Hashing Function is Best – Bcrypt or Argon2? 🔍 2:00 – Bcrypt Example – How It Works ⚠️ 6:45 – Why Bcrypt is Not the Best Choice – Example 2 🚀 8:40 – Argon2 Example & Why It's Better 🏆 11:25 – Final Verdict: Which One is Better? 🎯 12:20 – Outro & Next Steps
Hello what's up guys today in this video
we will see the differences between v crypt
and agan 2 yes guys so today we have to see
which hashing function is the best
okay so you can see what it
means so this is our guys
whenever a user is registering obviously
what we are using guys his username
email and then password so previously
like at the initial stage we were
storing the password in this way in our my
sequel database with the help of
drizzle ray right so you can see the
quality that I wrote for the first time was in this way but in
case if it falls into the hands of someone else the
wrong person then guys there
can be some loss so
in that video I will tell you that the work of
both is the same hashing the password but
which of the two hash functions is best for
you guys today I am going to tell you that in this video
so guys you can see that
you will get the source code absolutely free
link I will give it in the description and comment
section below, you can just clone and do the
work. Okay, else I would like that if
you are following me then you
can easily like and check it out.
Day by day I am writing the code, you can
write it yourself. So guys I do one thing,
today I want to tell you the differences. Right then
what do I do, a new guys, simply create a
folder, I mean I create a file by
unchecking it. Okay, I have created a new file.
This is it. Now here
I already have the code, so
I copy it and paste it here.
So one by one I will explain
what is happening. Here I told you that we
have two hasing functions, that is one is
your Bcrypt, the other one is your what next
to last. I am commenting on this.
Okay, now Bcrypt also if you
go to the market then you will find two types of Bcrypt
hasing functions. Okay, if you run
Bcrypt JS in this way. So here
you can see, first you get Bcrypt
JS and second you get Bcrypt, right,
guys, you can understand that one browser base is
supporting one browser more and the other one is the one which
we normally use more,
so here you can see Optimize
Bcrypt in JavaScript, that is your
Bcrypt JS and this one is a library
to help you hash passwords and all these things, so guys,
you can use any of the two,
it doesn't matter but for today's
video we will go with the Bcrypt JS.
So here you can go, simply
install
it here and run it here and basically we had yesterday's
previous video, even if you
look at that, we have already seen that
this Bcrypt part of mine would be somewhere,
basically here, see, this is the
password with Bcrypt, I have already told you,
but guys there is a limitation,
what is that, I will tell you, okay, so
here we come first. First we
imported it, not a big deal, we created a hash
function where what we are doing is
hashing the password with 12 values, which is
our salt, right, so in this
way, whatever your password is, it will be hashed, it
means what you are seeing, you are going to get your password in
this way.
Now
after that, when you hash the password, then there will be
a user who wants to log in, then at the
time of that login, we have to check whether the
user has entered the email ID and then his password
correctly or not. Then we
check that password, that too again we
do with the help of the same hashing function, and for that we will
use the backup compare method, in which you put the
password first and then hash the password, we
put it in this way, so basically on one hand
you are hashing and on the other hand you compare
after login whether the password is correct or not. So, you have
understood this much, don't worry,
I will explain in full detail and what is the problem,
I will tell you. After that you
can see what we have done here, we have
created two passwords, the first
password is of length 71, the second
password is also of length 71, but
what should we do after that we are including
some more random numbers using math dot random method,
we are adding them,
so now its total length will be more than
71,
this is happening because of that now we are
consoling do lock password and password two, now once you have
created
your password, now what you have to do with it, you have to hash it as well,
right password, so this is normal but you have to
hash it, so
for hashing guys you can see hash password,
I had just told you a little while ago hash password,
in which you have hashed the password, it's
easy then after that you are comparing the passwords, and those
two passwords are same or not,
so for that verify password verify password is the
same function, but which ones am I checking,
look password one and Then hash
password one means it is obvious that my first
password and then its hash
password, both will be obviously true,
right, because I am not doing anything wrong here,
I am writing what is,
but obviously my password two and
whatever is the hash password of my password one,
both cannot be the same,
obviously they are the same, in the same way password two and then
my hash function of password two will be the
same and again password one and hash of
password two, basically our password will
not be the same, right, so the output should be
like one and one, so it will be true, guys, again, true,
again, false, right, this was
simple, right, so I go here, to
this place, so I am going and heading here, for
a second, it is telling something, so
guys, it is telling here, becrypt, okay, oh
my God, basically I forgot to import it, so it's a
good thing, I will
import it for you people
because I am also working with you. So if
we work together clearly, it's
okay. Now I have installed it. It's not a
big deal. Now I have pressed OK again.
But it's okay.
Now I'll run it. So look, my
first password is this. Look carefully. Yes,
look carefully. My first password is this
much. Right, there is no issue. My
second password is something like this.
When you see it, it
's basically the password before hashing it. And when we
use the hash function, even a single
character if it mismatches, then
guys, our hash password is totally
different. And here we
can see very clearly that
my password has been changed at this place. It means that
password one and password two have nothing to do with each other. So,
here you can see that when we
compare password two with the hash function of password one, then no doubt it will be false. Then again, if we compare the hash of password two with password
two, it will
come out true. And then it will fall.
This was absolutely basic, absolutely normal. There is no
problem but now there is a
problem with B Crypt Jas and when we go through
this series we will not use B Crypt Jas now
we will use Argon 2 and the
problem is B Crypt Jas works for you
till 72 characters it
works for you only till 72 characters
it does not work as soon as it goes above 72 characters I mean 72 let's say
you have given 80 characters then
it checks it only till 72 characters guys do you
understand what I said tell me see till the
length was 71 there was no problem let's say
now I am making it 73 here okay
so the moment now if I add 73 characters it means
now my password has 73 characters okay
and I am doing anything
now watch carefully what happens
here
okay you are seeing the password it is something like this
and
look you have seen what has happened now true true true true
whereas this is wrong I
know very well that one was true no
problem two was also true, no problem,
but two and one were false for me and even
one and two were also false for me, but here it is
coming true because the
Bcrypt JS is matching only the first
72 characters and
obviously all of our first 72 characters are
x xx x xx only, so
after that it is getting changed, so that when
using Bcrypt, we
also use sorting, so that we
can create our password better so that
we can beat that Rambo table also, right,
so now to solve this problem we have
argon two, okay now
obviously I am removing this also,
argon two which is there will come here, obviously I
know it will tell me to install, so
I am doing npm install argon
two and this is it, this has also been
installed for me now where earlier I was
using Bcrypt Now I will use
argon to see there is no difference
in both the method is same argon 2h is by code it's
just that you used to write the password and then
we used to give the value of salt but in argon
2 we don't have to write that value also
like by default and internally it is doing it
on us and if you don't getting
my point that what are we talking about here so guys
this video is about second
password hashing that
how can you secure your password please do
check out this video in this I have
shared all the details with you from A to Z
their structure
when you are hashing in argon 2 or when
you are hashing in bcrypt then their structure is the
first character the
characters after that then
what is the meaning of the characters after that
I have explained all that in this video do
check it out it is very important it will be
useful for you life time yes now here is a
difference Yes now the difference comes here,
look on one hand when you use Bcrypt
and then the moment comes that now you have to
compare the passwords like whether the passwords are
matching or not, right so
in Bcrypt we have a compare method but when it comes to that we
have a verify method so
here we are verifying whether
both the passwords are same or not, in Bcrypt we used to
compare them, right so I will remove it in
this way and one more thing is also that
you have to keep a lot of attention and that is
when you use Bcrypt, first of all
your normal password comes and then
in a second field the second value is
your password and
you have to maintain this, this rule is such
that the first one will be your normal password which the
user is typing and the second one is the has
password which is already stored on the database,
so you compare both of them in your
Bcrypt but when it comes to your then It is
exactly the opposite of that, like first
your parameter is there we need to pass the
hash password which you are getting from your database
and then the second one is the actual
password which the user is typing while logging in
and we verify that, there is
no difference between these two and then verify and
this is the only difference between these two and
we do not have to give the value of salt here, the
third most important thing is this,
now even if you go above 72 characters,
it does not have any issue, okay, rest of it, there was no
problem here at all, now
if I go to refresh, oh I
refreshed it again in a hurry but this is it see true
false, you saw,
even after like writing 73 it is true it is
false it is true it is false so now
what is there in this that it is checking only till 72 characters and
not checking after that, there is no such
scene here, the next one is visible clearly,
you are seeing it clearly, it is better than
your bcrypt and still many people
Bcrypt I am still talking about bcrypt but
guys the market has come up now
a lot of new things have come in the market
one of which is that from now on we are going to use
argon 2 instead of bcrypt
like even if I make it 80 80 here let's make it 93 even
then you can see a little bit
how it happens and you can see the speed also
when we were using bcrypt the speed was
also a little true false pause pause what was the
difference here it is coming even like
here I have made the length 93 now its okay
and don't worry about it at all nothing
just I am creating a guys string of basically length of 93 characters
in which there will be only x ones and nothing else
that is simple you could have written either x repeat 72 something like that
so or guys this is it that's
it for today this video I
hope you liked the video very much
believe me these small
videos are very important which will be useful for you I am
going ahead and telling you the truth, especially
in big projects, so guys, let
me know in the comment section, which one you will prefer
in your project Aagan To of B
Crypt, but we are through out the series, now we are going to
play with Aagan To and yesterday
we were hashing the password and then the
verification that we were doing, now we are going to complete it with the
help of Aagan To, not B Crypt, so if you
liked the video, then guys,
please like it, the source code is absolutely
free, I am doing all this, so guys, please like it,
share it with your friends
and if you have not subscribed to the channel yet, then
please do so, I will meet you in tomorrow's
video till then guys, thank you so much, take
care
[Music]