I'm looking for a password hash method for a new server system. The hashes must be generated from PHP code and verified from PHP as well as by a number of applications on a Linux system.
I know that plain or salted MD5 and SHA-1 are not a good solution. I hear that sha256crypt and sha512crypt should be okay today. I once read that the sha2crypt algorithms are now very easily cracked, rendering them useless. I often hear bcrypt recommended. But there's also been multiple issues with bcrypt by now. $2$ doesn't seem to be relevant anymore, but $2a$ and $2b$ are incompatible as I understand it. And at least PHP has a strange understanding of fixing things by reusing the $2a$ prefix for the $2b$ algorithm, making it incompatible. I don't know what $2x$ and $2y$ stand for. PBKDF and scrypt don't seem to be supported by anything so I can't use those.
PHP can generate bcrypt hashes with the password_hash
function, but it doesn't seem to be able to create sha256crypt or sha512crypt hashes, neither with password_hash
nor crypt
which will decide on its own what algorithm to use. I want to specify the algorithm because not all applications support any algorithm.
For now the sha512crypt algorithm looks most promising, considering compatibility first, then security. (A super-secure thing that simply does not work is still useless.) But PHP can't generate those. Am I stuck with crypt()
using SHA-1 again? (That's what it does: $1$)
The OS is Ubuntu 14.04 and the applications are exim, dovecot and proftpd for now. PHP version is 5.5.9.
So what should I do? I'm fully confused by everyone right now.