Re: how to implement password protection for an application?
- Posted by euphoric (admin) Jul 07, 2009
- 1003 views
If I want to password protect an application, so it can't run unless a password is entered, and I want data file used by application to be encrypted, how do I go about asking user for password, and protecting the password from hacking?
If all you want is password protection, I suggest using an MD5 hash. Just store the hash of the password in a plain text file. Then whenever the user enters the password, hash that and compare it to the stored hash. If the hash matches, then it is the correct password. Encourage your users to use upper and lower case letters, numbers, and special characters to help keep the hash from getting cracked by a brute-force attack.
Is the password protection to be used for insuring your software is not used by unlicensed users? If so, you'll need to add a unique identifier to the MD5 hash (such as the PC's primary hard drive serial number) otherwise it can be easily shared among many PCs.