Created
August 14, 2012 14:45
-
-
Save jreinke/3349922 to your computer and use it in GitHub Desktop.
Default password encoding in Silex micro-framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; | |
$encoder = new MessageDigestPasswordEncoder(); | |
echo $encoder->encodePassword('foo', ''); | |
// 5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg== |
Hi
How to compare two encoded password using the same salt.
Thanks
Thanks bro!
Not sure if something changed but now with Silex 2.0.3 (Symfony 3.1.5) to get a password from the console (so using the framework and not Silex) to generate a password I have to use:
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
$encoder = new BCryptPasswordEncoder(13);
$pwd = 'sens';
$hash = $encoder->encodePassword($pwd, '');
echo "\n$pwd\n$hash\n";
The hash keeps changing but according Authenticating against a Database. Hashing a password it's ok as
A salt for each new password is generated automatically and need not be persisted. Since an encoded password contains the salt used to encode it, persisting the encoded password alone is `enough.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fresh.