Created
November 15, 2017 23:07
-
-
Save thiamsantos/9d73bbbbdc9423d29bb5f9cbc6f906ed to your computer and use it in GitHub Desktop.
password hashing bcrypt + sha384
This file contains hidden or 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 | |
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