I'm writing an api that need to use hash function to hash password. After reading this https://docs.phalcon.io/en/latest/reference/security.html , I think that using Bcrypt is a better way than md5 or sha1. First I setup it in di
$di->set('security', function(){
$security = new Phalcon\Security();
//Set the password hashing factor to 12 rounds
$security->setWorkFactor(12);
return $security;
}, true);
Then I call it in my route, this is just my test to see if password it hashed
$app->get('/api/user/genPass/{password}', function($password) use ($app) {
$data = array();
$password_hash = $this->security->hash($password);
$data[] = array(
'password_hash' => $password_hash
);
echo json_encode($data);
});
But I get nothing in the response. I've tried with sha1 and md5 (instead of $this->security->hash) and everything is fine. Anyone know why?
Thank you very much