Creating and Verifying Hashes in PHP 5.5
jcurcio.com
Creating and Verifying Hashes in PHP 5.5
1–10 of 44 posts
Re: Creating and Verifying Hashes in PHP 5.5
#2Re: Creating and Verifying Hashes in PHP 5.5
#3Re: Creating and Verifying Hashes in PHP 5.5
#4https://github.com/ircmaxell/password_compat
Written by Anthony Ferrara, the same guy behind the `password_*` API in PHP 5.5
Re: Creating and Verifying Hashes in PHP 5.5
#5But that didn't always happen. There do exist experienced PHP devs who would do password storage the right way but PHP up until now neither made it easy nor encourage these practices as they relate to passwords. Now I hope word gets out about this and people stop using md5() thinking their passwords are safe. Not that md5 is necessarily bad, but most people don't realize there are better tools for maintaining secure passwords.
Also, this reminds me a little bit of `has_secure_password` method in Rails minus some of the automation that comes with it.
Re: Creating and Verifying Hashes in PHP 5.5
#6There's also a library for PHP >= 5.3.7 that provides the same API if PHP 5.5 isn't an option yet. https://github.com/ircmaxell/password_compat Written by Anthony Ferrara, the same guy behind the `password_*` API in PHP 5.5
Re: Creating and Verifying Hashes in PHP 5.5
#7Re: Creating and Verifying Hashes in PHP 5.5
#8Re: Creating and Verifying Hashes in PHP 5.5
#9This is really, really dumb and pointless. In fact it makes absolutely no sense, it tells password_hash to use a bcrypted "MySalt" as a salt.
Not only is there no reason to explicitly provide a salt unless you already have bcrypted passwords in a non-standard format, (in which case you'd pass the existing $salt directly, you wouldn't bcrypt it) this is an inane way to generate one.
If you want to generate your salt by hand, don't do it. If you really, really, really want to, use mcrypt_create_iv.