Unhashing a password or holding unhashed password

2019-09-23 00:34发布

BACKGROUND

I am making a personal password vault. I will be the only one that uses it and maintains it. I am doing it to practice cryptography as a personal project.

WHAT WORKS

I have a login page which is linked to a "Users" table in the database that stores my username and a password that has been salted and hashed. I have the method that will check what I type in the password field against the hashed/salted password within the database and that all works fine so I can log in successfully.

WHAT I REQUIRE HELP WITH IF POSSIBLE

I wanted my app to log me in and I have a list of all places I type in a password eg. other apps, websites etc. within a datagrid. I will click on the one I want, click a button and a messagebox will show up with an unhashed version of the password. From what I have read a hashed passsword is unhashable so didn't know what the best way to this would be, if at all possible, other than to store unhashed passwords (which defeats the object!).

Cheers

2条回答
叛逆
2楼-- · 2019-09-23 01:30

A central principle of a hash is that it is one way, as you have read. Since you want to be able to perform a two way conversion between your data and a secured version you need to use encryption, which is specifically designed to both encrypt and then later decrypt the data in question.

查看更多
欢心
3楼-- · 2019-09-23 01:33

One way of doing this is to store plain text passwords and encrypt the file (or the blob) with a master password that you remember.

Any time you need access, you'd provide this master password and decrypt the file to access passwords.

Depending on your design, you can prompt for master password once (say app startup) or everytime.

And make sure you do not write or persist the plain text passwords anywhere unencrypted!

You can hold them in memory for the app's lifetime to make the UX easier so next time when the app starts up, you repeat the same process (i.e. ask for master password, un-encrypt, use and then quit).

查看更多
登录 后发表回答