Using cryptographic hash to match AES key size I am making a tool for myself where I intend to store cipher text. I wish to use AES together with arbitrary sized keys to create these cipher text strings. The idea is to use a cryptographic hash like SHA256 to compensate for the key length issue.

Is this a sound way of doing things?

Also, since the output domain of SHA256 is much larger than any key a "normal" person can remember, does this add security if an attacker gets hold of the password digest from for example a computer?
Is this a sound way of doing things?


Depends. Where do the keys come from? If they come from a user's memory (e.g., a password) then no. The reason for this is that a simple hash if fairly fast to compute. Typically we recommend people use something like PBKDF2 or scrypt as they run through thousands of iterations. The effect of this is that computing this function once is still fairly fast and user won't notice the delay. Trying to brute force it, however, involves computing the function many, many times. This slows down a brute force attacker significantly. Also, scrypt in particular was designed to be slow on hardware. That means attackers can't throw a GPU or other hardware device at the problem to speed it up.


  Also since the output domain of sha256 is much larger than any key a "normal" person can remember, does this add security if an attacker gets hold of the password digest from for example a computer?


No. We often measure security in bits. In particular, bits of entropy. A deterministic function (like sha256) cannot create entropy.