A service that can email you your existing password is storing it in a recoverable form, which is a design failure rather than a convenience. Properly built systems keep something that cannot be reversed into the original text.
A hash runs in one direction only
A cryptographic hash function takes input of any length and produces a fixed-length output, and the process is designed so that recovering the input from the output is computationally impractical.
When an account is created, the system stores the hash rather than the password. At login it hashes what was typed and compares the two results, never needing the original.
A stolen database therefore yields hashes rather than passwords, which is why breach notifications distinguish between the two and why the difference matters enormously to affected users.
Guessing is the attack, not reversing
An attacker with a stolen file does not try to invert the hash. They guess candidate passwords, hash each one and look for a match.
This works because human-chosen passwords are drawn from a far smaller space than the theoretical one, and common choices repeat across millions of accounts.
Precomputed tables of hashes for likely passwords make this faster still, turning the attack into a lookup rather than a computation performed for each target.
Salting defeats precomputation
A salt is a unique random value generated for each account and combined with the password before hashing, then stored alongside the result.
Because every account has a different salt, identical passwords produce different hashes, and a table built in advance is useless against the file.
The attacker must attack each account separately rather than cracking the whole database at once, which multiplies the work by the number of accounts.
Slowness is a deliberate feature
General-purpose hash functions are built to be fast, which is exactly wrong for passwords, since speed helps the attacker far more than the legitimate system.
Password hashing functions apply deliberate cost, repeating work many times and in some designs requiring substantial memory, which resists specialized cracking hardware.
The cost is tuned so a single login takes a fraction of a second while a mass guessing attack becomes expensive at scale. Systems increase that factor over time as hardware improves.
Hashing does not fix weak passwords
None of this protects an account whose password appears near the top of a common-password list, since such a guess succeeds within the first attempts regardless of salting or cost.
Reuse across sites carries the same problem from the other direction. A password cracked from one poorly built service is tried immediately against every other account sharing that email address.
Which is why length and uniqueness do more for an individual account than any storage choice made by the service, and why second-factor authentication remains the meaningful backstop when a password does fall.