Sorry if this is a stupid question, I just want to know: what is the point with the salt in bcrypt? I mean, if you have the following code for creating a hash from a password:
function generateSalt() {
$salt = '$2a$13$';
$salt = $salt . '1111111111111111111111';
return $salt;
}
function generateHash($salt, $password) {
$hash = crypt($password, $salt);
return $hash;
}
$salt = generateSalt();
$providedPassword = generateHash($salt, rand(3,29));
echo $providedPassword;
The above outputs for example:
$2a$13$111111111111111111111uDdpsIcwCVOwEyNueskskXkniY5206fW
$2a$13$111111111111111111111udcvrNt9quPukFRl8./jXRzDGfE9lw0W
So you can clearly see where the salt ends, and if someone gets the database there's not point with the salt, since they just can remove the salt-part and search for just the hashed password. So, am I using bcrypt wrong? (the static salt was just to show where it appears in my hashes), or is there a reason with this?