Skip to content

Instantly share code, notes, and snippets.

@thiamsantos
Created November 15, 2017 23:07
Show Gist options
  • Save thiamsantos/9d73bbbbdc9423d29bb5f9cbc6f906ed to your computer and use it in GitHub Desktop.
Save thiamsantos/9d73bbbbdc9423d29bb5f9cbc6f906ed to your computer and use it in GitHub Desktop.
password hashing bcrypt + sha384
<?php
class Password
{
public static function hash(string $password): string
{
return password_hash(base64_encode(hash('sha384', $password, true)), PASSWORD_BCRYPT);
}
public static function verify(string $password, string $hash): bool
{
return password_verify(
base64_encode(
hash('sha384', $password, true)
),
$hash
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment