0

I want to use symfony 2.5.10 security in order to login in from users that were created with pyhton/django security. Passwords in db that are encrypted in this format:

pbkdf2_sha256$12000$dVPTWPll8poG$3weiWwv4P/2GgYjeJBeUN/Hlbe1UByCj7ZRVX93FBZE=

I want to do this because I want users to have same passwords for the new app.

2 Answers 2

2

You have to write password encoder on your own. Django uses following password format:

<algorithm>$<iterations>$<salt>$<hash>

It means hash uses the PBKDF2 algorithm with a SHA256 hash, 12000 iterations, dVPTWPll8poG salt (for this particular password) and password hash itself is 3weiWwv4P/2GgYjeJBeUN/Hlbe1UByCj7ZRVX93FBZE= (BASE64 encoded).

Symfony has password encoder for PBKDF2 but it does not support Django format. You can just modify built-in password encoder. You have to extract iterations, salt and pbkdf hash from string in database. The rest is the same as in default encoder.

https://github.com/symfony/security-core/blob/2.5/Encoder/Pbkdf2PasswordEncoder.php

Here is another stackoverflow answer on how to write own password encoder.

Symfony2 create own encoder for storing password

Hope that's help.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! Now it's the time to give this a try.
What is the format of the symfony's built in password encoder? In what format to store the django password?
0

Django uses hashing to store user passwords. Depending on your settings.PASSWORD_HASHERS setting it will use one of these functions.

You will have to port same hashing algorithm in php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.