I'm learning PHP and I've come to the password hashing section of a course I'm following, but it's not explained well enough for my liking.
It seems that when using the crypt function, and using the CRYPT_BLOWFISH hash type, I get a resultant hash that contains the salt itself.
For example with the following code:
$salt = '$2y$10$iusesomecrazystrings22';
$password = crypt($password, $salt);
And using the password "123" I get a resultant \$password of $2y$10$iusesomecrazystrings2ui1qr860E30b0c9ijNqwCSwHnHdgz.1K
once hashed. My question is how is this hash not reversible, if a hacker were to obtain it, given that the salt is in the hash itself?
I know that hashes use a many-to-one input-to-output mapping, so it may be difficult to reverse the hash to the exact password used, but surely it could be reversed to one of its many collisions, so to speak. However, I know that I must be wrong but can't explain why.