I've been reading about password storage, and have basically found 2 commonly used techniques.
- encrypting all of the passwords stored with a single key.
- Using hashes
- Using hashes with salt.
Is there a flaw in storing the password "encrypted by itself", i.e. encrypting a txt which says password1
with the password password1
without storing it unencrypted, and when a user wants to log in, decrypt, compare and grant access (or not)?
I am not very literate in this topic, so, can somebody enlighten me?
This has three weaknesses over using hashes with salt.
password1
) and see if they self-encrypt to the stored value. Worse, depending on how you do the encryption, this could be done offline, before getting hold of the password file, with the results stored in a lookup table so that when someone gets your file then it can be cracked instantaneously.Really, there's no reason at all to do this, when there's a solid and well-established technique that does it much better.