Saturday 15 September 2012

php password hash and verify !false -



php password hash and verify !false -

what missing password_hash , password_verify functions in php5.5 because doesnt work me.

if hash , verify 1 line, works:

php -r "var_dump(password_verify('123', password_hash('123', password_default)));" bool(true)

but if separate them on 2 lines, doesnt work:

php -r "var_dump(password_hash('123', password_default));" string(60) "$2y$10$uturqritdzbx.m9ectzemowtda5kwkdn2ucdjyfts2m8egxe/xp3o" php -r "var_dump(password_verify('123', '$2y$10$uturqritdzbx.m9ectzemowtda5kwkdn2ucdjyfts2m8egxe/xp3o'));" bool(false)

it shell interpreting of characters before running command. if using bash shell $ character means start of variable. have escape these characters bash not interfere

php -r "var_dump(password_verify('123', '\$2y\$10\$uturqritdzbx.m9ectzemowtda5kwkdn2ucdjyfts2m8egxe/xp3o'));"

this return

bool(true)

php

No comments:

Post a Comment