In this video, let's try to look at the next passport and court provided by spring security, which
is beginning to passport in the name Looks Bedivere.
But there is some meaning behind that.
The name Peepee KDAF means passport based derivation function, too.
And this passport encoder is a pretty stronger than whatever we have seen previously, like no passport
encoder and standard passport.
And the reason is on top of providing a feature of secret ASOL for hashing, it also has two other parameters.
One is how many times you want to iterate for encoding.
And at the same time, what is the length of your hash that you want to generate?
The more the length of the hash and the more number of iterations that we choose, the stronger your
hash will be for anyone to be correct.
But it comes with its own drawbacks, like it's a slow hashing mechanism since it will perform so many
iterations and it will take enough measures to maintain that length of the hashing.
Due to that reasons, this password encoded is this slow compared to other encoders available in the
spring security.
And to use it, we have three options.
One is where you can directly create a simple constructor without any documents.
That means I don't want to mention any secret.
And at the same time I want to go with the default iterations and the full length of the hoshko.
And the next constructor is where I'll pass the secret that I want to use.
And I'm good to go to use the default values of the number of iterations and the length of the hash.
Last one where I have an option of providing the secret number of citations that I want or the length
of the hash that I want to generate.
So usually by default, for all these constructors, Spring Security Council does one eight five triple
zero as the number of default addresses that it will go, and 256 is the length of the number of bits
that the hash can contain after generating hash outside the normal text.
Using this password.
So these are the three different constructors available.
Let's try to go and look in the code also.
But this president in the same package, like any other password encoders, and it implements password
encoder and here you can see if I'm not specifying through my constructor's, this encoder will construct
default hash with as 256 and default iterations as one eight five triple zero and always have an option
of lowering them to make it even more stronger, to reduce the complexity of the hash by decreasing
these numbers through the third constructor that we have seen.
So here there are three constructor's plus one is which won't accept anything.
And if you're not passing any secret that will call this constructor internally with empty string,
very empty string will be used and default depression and default hash with will be leverage.
But you can also directly call this constructor by passing a secret with default iterations and default
hash, which will be used followed by.
We also have a constructor where you can customize ASPO requirement by passing the secret iterations
on the hash with suppose that we have in code, which is a word method.
This method will be used by Springsure to convert my orginally text of the password into an encoder
encryption by the algorithm, by the side and other parameters that we have use.
And at the same time we also have matches where it try to compare.
After converting or encoding my password with already encoded password in the database, it will try
to compare both of them and they both matches.
It will give it Boolean as true.
But again, you can see here this is not a completely one way hashing.
Due to that, though, it is far better than standard password and for the reason that it is doing more
iterations and it is allowing us to mention the password learn.
But still, this is not recommended to use when compared to the script and a script, password and course.
So let's try to look into a password encoder in that mix.
Thank you.
And by.