Is it correct that increasing the iteration possibly decreases the cipher strength but increases the amount of time it would take to find the original hash values if using brute-force on a given hash? (i.e. from a compromised database)?
In other words, if someone accessed user password hashes would be better to protect against weaknesses in the cipher implementation or weaknesses in the amount of time it takes to calculate hashes?
public function hash_password(password, usersalt)
{
var result = hash('sha256', usersalt . SITE_SALT . password);
for (i = 0; i < 100; i++)
{
result = hash('sha256', usersalt . SITE_SALT . result);
}
return result;
}
Note: SITE_SALT
is a value stored in a configuration file outside the document root. usersalt
is a unique salt generated for each user and stored with the password hash in a database.