The best way to store the username is in plain text. The best way to store a password is not to store it at all, but only its hash. When you receive a login attempt, you hash the password and compare both hashes.
This is a little naive, though, as it is vulnerable to hash tables (wikipedia for rainbow table). This is easily avoided, anyway, storing a different salt for each user. A salt is simply a random number or string that you concatenate to the password prior to the hashing.
So the operations when trying to log in would be:
- Search the database for a hash and a salt related to the given login.
- Concatenate the given password with the previous salt.
- Hash the result of the concatenation.
- Compare the computed hash with the database one. If they match, grant access!