Skip to content

Cannot verify the password after hashing #91

@jackyshek

Description

@jackyshek

I have tested the password_verify of PHP that does not verify correctly. I am using centOS and PHP version 5.3.3.
It is always to return true with different passwords when i verify it. Is my code has bug?

Here is my code:

$password = 'k32AlGOPqvCzoh*Sp(Hdrr26]M=lQb00R&W=hew|-|([(03vp==A8%m?l=eA2^bs_|\qVV3WZ';

$verify_pw = 'k32AlGOPqvCzoh*Sp(Hdrr26]M=lQb00R&W=hew|-|([(03vp==A8%m?l=eA2^bs_|\qVV3WZasdasdasdasdqweqa13123';

$options = array(
            'cost' => 15
        );

$hash = password_hash($password, PASSWORD_BCRYPT,$options);

var_dump(password_verify($verify_pw ,$hash)); // sometime true sometime false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions