What I do:
PHP Code:
function hmac ( $password, $salt, $algo = 'sha512' ) {
return hash( $algo, strrev( $salt ) . hash( $algo, $salt . $password, true ), true );
}
$ck = '...long long super long constant salt...';
$uk = '...long long super long user salt...';
$c = hmac( hmac( $password, $uk ), $ck );
var_dump( base64_encode( $c ) );
I have a site specific salt which is the same for all users. But I also have a user specific salt that is randomly generated using a cryptographically secure pseudo-random number generator (CSPRNG) that is quite long, way more then 16 characters.
Now...what I actually do is a little more complicated then what it shown here.
Bookmarks