Skip to content

Instantly share code, notes, and snippets.

@dededey
Created March 31, 2016 15:22
Show Gist options
  • Save dededey/92041a05694f54c764fb76a5902a15b8 to your computer and use it in GitHub Desktop.
Save dededey/92041a05694f54c764fb76a5902a15b8 to your computer and use it in GitHub Desktop.
password salt generator and has
$salt = uniqid(mt_rand(), true);
function getSaltedHash($password, $salt) {
$hash = $password . $salt;
for ($i = 0; $i < 50; $i++) {
$hash = hash('sha512', $password . $hash . $salt);
}
return $hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment