I'm writing a WPF password manager application to practice programming, so far this is the scheme I intend to use to store master password and individual site password:
Master password:
- Generate a random salt.
- Hash the master password + salt with SHA256
- Stored the hash and salt in DB as text.
For each individual site password:
- Generate a random salt.
- Hash master password + salt with SHA256
- Use the hash as AES256 encryption key to encrypt site password.
- Store the encrypted site password as binary blob and the salt as text in database.
Obviously for this to work the user will have to retype master password everytime he want to decrypt a site password, or I will have to store master password in memory.
Now to my question:
- Should I use the same hash function while hashing the master password and creating encryption key, or should 2 different hash functions be used?
- Does the way I handle individual site password make sense?