Skip to content Skip to sidebar Skip to footer

Decrypt Python/django Password With Symfony 2.5 (using Symfony Security)

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_sha25

Solution 1:

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.

Solution 2:

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

Post a Comment for "Decrypt Python/django Password With Symfony 2.5 (using Symfony Security)"