Nonethless an MD5 hash can be useful with passwords.
A common headache involves passwords stored in a database. Here storing the hashed value ads a modicum of security.
An assumption is that what is really being protected is the users' identity. After all, if a hacker gets the database, he or she
has all the current data.
The identity is only protected in the sense that hashed passwords can't be used to authenticate as an existing user
when operating against the database via the production application. The assumption here is that feeding in a hashed password will simply cause the application to "rehash" it, which will not match the stored value.
Even if the application code
and database are stolen, the only way to impersonate users based on the hashed passwords would be to alter the application code to stop hashing on authentication (or provide a non-hashing back door logon). Then the crook would have to put the altered code back into production on the machines hosting the application logic.
If a bad guy can do that, passwords may be the least of your troubles.
A brief discussion of this can be found at
MD5 and passwords.
Some web applications even accept passwords client-side, concatenate these with the user name and other junk, then take the MD5 hash and send
that back to the server without a plain-text user name. The little concatentation dance is a small attempt to defeat dictionary attacks, because just hashing the password makes it easy to probe with a hashed dictionary of likely password text.
Since the risk of collisions in 128 bits is small but possible, some applications hash the user name
and the password (or password + user name) and send the server
64 hex digits (2 MD5 hashes) as the authentication string. This reduces the potential for collisions a bit more.
In any case, this provides a modest shield against sniffing when not using secure authentication or SSL. Even then the application at the server generally hashes this stuff yet again to store it in the database or before comparing it with what's in the database. This 2-level hash does 2 things: modest "sniffer shielding" as well as the stolen database identity protection described earlier.
Protecting the data in the event the database gets stolen is another subject though, and MD5 isn't much help there as others have eloquently pointed out.