When two users share the same password, the password hashes are generated in the same way. An attacker may quickly break the password using a dictionary or brute-force assault in this situation. To prevent this, a salted hash is used.
By prepending or adding a random text (salt) to the password before hashing, a salted hash is used to randomize hashes. As a consequence, two entirely distinct hashes are created, which may be used to safeguard the database users’ passwords from the attacker.