Skip to content

Help me understand encoder of symfony with md5 #42493

Answered by javiereguiluz
CosmicSnow asked this question in Q&A
Discussion options

You must be logged in to vote

@CosmicSnow if I understood you right, you expected hashed passwords to be $hashed = md5($plainPassword) but the actual value stored in the database is not that.

The reason is that Symfony doesn't simply perform a md5() of the plain password. It concatenates some strings and iterates several times to produce the final hashed password. The actual algorithm can be found here:

public function hash(string $plainPassword, string $salt = null): string
{
if ($this->isPasswordTooLong($plainPassword)) {
throw new InvalidPasswordException();
}
if (!\…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by CosmicSnow
Comment options

You must be logged in to vote
1 reply
@faizanakram99
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #42491 on August 12, 2021 05:19.