Skip to content

Instantly share code, notes, and snippets.

@greenpeas
Created January 13, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenpeas/47f1d1961aa22b188c50 to your computer and use it in GitHub Desktop.
Save greenpeas/47f1d1961aa22b188c50 to your computer and use it in GitHub Desktop.
Генератор пароля и соли
<?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