In general, you shouldn't be doing this yourself, but following the guidelines for the system you are using.
The "correct" way of storing passwords is with a "one-way" hash, with "salt" and "key strengthening".
The term "one-way" means just that. Once you hash it, you can never recover the password yourself. There's no way to ever recover the password. But, you can still check if the user has entered the correct password by repeating the hash on what they typed in, and see if it matches the one stored in the database.
If hackers steal your password hashes, they can crack them offline.
The most common crack is to pre-calculate a zillion password hashes. When they steal hashes from your site, they look them up in a table, and instantly find the original password.
To defeat that, you "salt" the password. You generate some random text, and hash that text with the password. You then store that salt+hash in your database.
This forces the hackers to "brute-force" your passwords instead of using a "table lookup". Hacker desktops can calculate 1-billion hashes per second, so they will quickly discover small passwords.
To defeat that, you simply repeatedly hash the value. If you repeat the hash a thousand times, the hacker can now only test a million per second.
Unfortunately, the more expensive you make it for the hacker, the more expensive you make testing passwords for yourself. Repeating the hash a 1000 times is a good compromise between slowing down the hacker and impacting the performance of your server.
Another way of slowing down the hacker are applying rules to passwords, such as demanding that they be at least 8 characters long and containing numbers and symbols. Most passwords are words, in all lower case letters. That means the hacker needs only test 26 combinations per letter. If passwords are composed of upper and lower case, numbers, and symbols, that becomes around 100 combinations per letter.
The point of the above is to teach you all the complications of how hackers attacks passwords, and the things administrators go through in order to defend those passwords. Usually, you don't need to worry about it: you just choose the solution the underlying system you are using has chosen for you.