Password hashing is but one, very small use for a hash. Hashes can be very valuable for other uses by themselves, in constructs that pair hashes with keys, and in other constructs.
For password hashing in specific, as always, you should read Thomas Pornin's canonical answer to How to securely hash passwords.
For this answer, the summary is:
In the event of a password database leak, sufficiently bad password storage (plaintext and/or reversible encryption where the key is known to the attacker) renders the best password worthless. Sufficiently bad passwords render the best password storage worthless. At this level, nothing is safe, because one or both parties failed to reach the minimum required bar for any kind of safety.
Then we get to "really horribly awful password storage" like unsalted single iterations of hashes. This is just like the below, but each try applies to every single password at once. At this level, only unique, insane passwords are safe, as two users with the same password are obvious - they have the same hash.
Then we get to "really awful password storage" like unique per-row salted single iterations of hashes. Of any hashes, though obviously slower (to the attacker) hashes have a smaller range of passwords that are worthless after a given amount of time spent trying guesses.
- All the per-row unique salt does is force each candidate password to be re-hashed for each password hash
- And prevent precomputed hashes from being worth much.
- Assuming January 2015 oclHashcat speeds for a single machine with 8 R9 290X's
- 2.4E17, or about 2^57.7 single MD5 tries per 30 days
- More or less 4 words chosen cryptographically randomly from all words of length 7 or less in Ubuntu's American English Small dictionary, i.e. roughly 21000^4 or 1.9E17, or 2^57.4, is this keyspace.
- Yes, "correcthorsebatterystaple" is in this set. See my answer to Should I reject obviously poor passwords for further math.
- 1.2E16, or about 2^53.4 single SHA-512 tries per 30 days
- Nine character cryptographically random passwords with Upper, Lower, and number characters are about this keyspace (62^9, or 1.35E16, or 2^53.6).
- Insanely strong passwords are safe here.
- 35 character cryptographically random passwords of upper, lower, and numbers are roughly as safe as 192 bit encryption, at 62^35, or 5.4E62 or 2^208.4 possibilities.
- Strong passwords are probably ok
- 20 character cryptographically random passwords of upper, lower, number, and US keyboard symbols are roughly as safe as 128 bit encryption, at 94^20, or 2.9E39, or 2^131.1 possibilities.
- 14 character cryptographically random passwords of upper, lower, and number are about the minimum I'd call "maybe safeish for a few years, but not for decades" at this level, with 62^14, or 1.2E25, or 2^83.4 possibilities.
After this is using good, solid algorithms, i.e. PBKDF2, BCrypt, or SCrypt, with low iteration counts. This is where hashing is safe for reasonably complex passwords!
- Remember, PBKDF2/RFC2898 is merely a construct for iterating an HMAC many times.
- Remember, HMAC/RFC2104 is merely a construct for using a hash (like SHA-1, or MD5, or SHA-512, or Whirlpool, or ...) with both a key and some data
- Assuming January 2015 oclHashcat speeds for a single machine with 8 R9 290X's
- 2.9E12, or about 2^41, WPA/WPA2 tries per 30 days
- 8 character cryptographically random passwords of just a letter and number (36^8, or 2.8E12) are close to this.
- 3 cryptographically randomly chosen words of length 7 or less in Ubuntu's American English Small exceed this, 21000^3, or 9.2E12
- Cryptographically random patterns of one uppercase, 7 lowercase, and one number are in this keyspace, 26*26^7*10, or 2E12
After this is using PBKDF2, BCrypt, or SCrypt with a sufficiently high number of iterations/work factor. At this level, hashing is safe for slightly less complex passwords, and/or for a slightly longer time.
Note that, amusingly, PBKDF2-HMAC-MD5 is, with a sufficiently high iteration count, actually not broken, though you'd either have to be an idiot to use it, or you'd have to be working with something like an FPGA with enough gates for MD5 but not for SHA-1 or SHA-2.
Note that attackers always gain more power... and that password leaks stay in the wild forever. All passwords that get found should never be considered safe again - the largest wordlist I've seen contains gigabytes of previously cracked or found in plaintext passwords, and some are horrifically complex... but they were stored badly, and are now in wordlists.
Rules based attacks using dictionaries are a topic for another question :).