Try to avoid using passwords as encryption keys.
A common weakness in many systems is to use a password or passphrase, or a hash of a password or passphrase, as the encryption/decryption key.
The The problem is that this tends to be highly susceptible to offline keysearch attacks. Most users choose passwords that do not have sufficient entropy to resist such attacks.
The best fix is to use a truly random encryption/decryption key, not one deterministically generated from a password/passphrase. However
However, if you must use one based upon a password/passphrase, use an appropriate scheme to slow down exhaustive keysearch; take a look at bcryptkeysearch. I recommend PBKDF2, or usewhich uses iterative hashing (e.g.,along the lines of H(H(H(....H(password)...))), with) to slow down dictionary search. Arrange to use sufficiently many iterations to cause this process to take, say, 100ms on the user's machine) to generate the key.