Is there a default built in function in PHP that allows for use of scrypt or bcrypt?
Asked
Active
Viewed 8,967 times
2 Answers
1
PHP Crypt function uses bcrypt.
If you're using PHP 5.5.0 or greater then you can use Password Hash with crypt.

Styphon
- 10,304
- 9
- 52
- 86
-
@user51819 I've added that, but most people still use < PHP v 5.5.0, so I added `crypt` first. – Styphon Jun 16 '14 at 14:51
-
Since PHP 5.3.7 you can use the [compatibility pack](https://github.com/ircmaxell/password_compat/blob/master/lib/password.php). – martinstoeckli Jun 17 '14 at 06:48
1
For PHP 5.5.0 or above:
Read the relevant FAQ on PHP.net. More notably, you should check out this page on password hashing. Example:
echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array('cost' => 12));
For earlier versions, look at the password_compat library by ircmaxwell.

Wayne Whitty
- 19,513
- 7
- 44
- 66
-
-
@user51819 With BCRYPT, the salt is stored in the hash. BCRYPT is secure because it is extremely slow and can be made slower if needs be. – Wayne Whitty Jun 16 '14 at 15:07
-