Created
January 13, 2015 08:49
-
-
Save greenpeas/47f1d1961aa22b188c50 to your computer and use it in GitHub Desktop.
Генератор пароля и соли
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 = '$2a$10$'.substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(),mt_rand()))), 0, 22) . '$'; | |
// Шифруем пароль с применением данной соли | |
$hashed_password = crypt($password, $salt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment