MD5 isnt an encryption algorithm.
MD5, or Message Digest 5, is a message digest algorithm.
It takes a message of arbitrary length, and outputs a hash of 128 bits.
It should be computationally infeasible for 2 given messages to produce the same hash.
Also, it should be computationally infeasible to find a message that corresponds to a given hash.
That said, since in theory there are an infinite number of messages, there should also be an infinite number of messages corresponding to a given hash.
So we're only talking about the usage in practice.
You could read [url=ftp://ftp.rfc-editor.org/in-notes/rfc1321.txt]RFC 1321[/url]
Incidentally, PHP now also supports SHA1 hashes, using [man]sha1/man
You can read [url=ftp://ftp.rfc-editor.org/in-notes/rfc3174.txt]RFC 3174[/url] for more info on SHA1
On brute force attacks: the main problem would be that users have a bad habit of using easy to guess passwords, so a dictionary attack might be used, which would considerably reduce the time taken.
This sort of relates to the idea that MD5 is not intended to encrypt passwords.
It is intended to provide a way of checking data integrity, as is SHA1.
It just happens that we can use this to prevent an attacker from obtaining the original password from a hashed password, assuming the password is well chosen.
There is no security other than that.