Created
November 12, 2020 21:06
-
-
Save ozrabal/09631879f1ed60a72dde03747adaf849 to your computer and use it in GitHub Desktop.
Symfony fos user password
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 | |
$salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36); | |
echo "Salt used: " . $salt ."<br/>"; | |
echo "<br/>"; | |
$password = 'new_password'; | |
$salted = $password.'{'.$salt.'}'; | |
$digest = hash('sha512', $salted, true); | |
for ($i=1; $i<5000; $i++) { | |
$digest = hash('sha512', $digest.$salted, true); | |
} | |
$encodedPassword = base64_encode($digest); | |
echo "Password used: " . $password ."<br/>"; | |
echo "<br/>"; | |
echo "Encrypted Password: " . $encodedPassword ."<br/>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment