Any equivalent of Yii CPasswordHelper?

I would like to store a hashed password in the database but by that time I haven’t load Yii yet (due to my custom application installer). I want to know the equivalent of


CPasswordHelper::hashPassword($password);

in PHP. SO far I have tried with the PHP


password_hash()

function like this:


password_hash(filter_input(INPUT_POST, 'portal_password', FILTER_SANITIZE_STRING), PASSWORD_BCRYPT, array("cost" => 13));

The result comes out like:


$2y$13$nhWAdiJeznsOqHph0yZaAOINqg14pGppOUqqyisaXsQuBtRKD076W

but when I tried to login with my original password, it failed. I notice that often the result of CPasswordHelper::hashPassword has


$2a$13

but mine has


$2y$13

prefix. Anyone could help? Thanks!

Before CPasswordHelper was added into Yii, I was using this class https://github.com/gamergemparq/Randomness using the blowfishSalt method. Possibly worth checking out.

Actually my approach was working fine :) It is another irrelevant mistake somewhere else that cause the login failed. Hope someone might find this useful and thank you for your time!