write the hashed password into the output file
That's like putting the house key under the door mat.
If someone decompiles your code, they have your passwords.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
Sorry, I'm not familiar with the functions you talk about. I'm only able to use methods in java.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
Not really..
Correct me if I am wrong, but isn't a cryptographic hash function (SHA1 etc..) a one-way thing. There is no unhash function that takes a hashed string and outputs the original.
If someone gets the hashed password, they still can't decrypt the file with it.
What would you suggest instead if this is a problem?
Only they will find hashes which are useless. Yes, hashing is one way and irreversible.
So what is your question as I have not understood it
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
Ooh! I get you now.
I would do something like
1. User enters Password
2. I hash the Password and compare to password hash stored as user password
3. If hash matches I use the key to decrypt, else I keep asking Username and present vague error like (smoething went wrong, may be user name or password is wrong)
As of risk, I would store user names vs password hashes in something like MySQL database or SQLite3 database. In case of SQLite3, I would password db file in such a way that only the application can access it. So each time user enters his credentials, SQlite3 db get decrypted and queried.
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392