I am working on for mail servers (this is open source if you want to take a look).
To do this, I need to be able to generate a hashed password that is read by Dovecot . As described on their wiki , their recommended password hash scheme is SSHA256 (optional S for salting).
It also explains that it can be quite simple to implement using something like this PHP code:
$salt = 'generate_a_salt_somehow'; $hash = hash('sha256', $password . $salt);
However, from what I read about cryptography, this is rather a naive way to generate salted hashes, but if you do it wrong when typing AES in the source code , I figured that might be true in this case.
So, if you have an understanding of cryptography, I would like to hear about the safest way to do this, be it mcrypt, mhash or something else.
source share