1

My code is like this :

<?php
    $password = '12345';
    echo bcrypt($password);
?>

It's not working

Its error is Fatal error: Call to undefined function bcrypt() in...

Whether to load library?

Thank you

moses toh
  • 12,344
  • 71
  • 243
  • 443

2 Answers2

2

As noted in this answer, you can use the following:

<?php
$password = '12345';
echo password_hash($password, PASSWORD_DEFAULT)."\n";
?>
cstroe
  • 3,740
  • 3
  • 27
  • 16
0

Try to do it this way

echo password_hash('123456', PASSWORD_BCRYPT);
krrskl
  • 91
  • 2
  • 5