Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
:confused:

Is there a way I can protect a windows form with a password that is NOT HARD CODED! and does not depend to much on a file??? what I mean is that if somone deleted the file the program would still work. I kinda need some code here.
Posted
Updated 18-Apr-10 3:06am
v2

Just store a hash of the password in some string in the program, re-hash the password that the user gives you, and compare it to the stored hash.
Note that a determined hacker will probably break this in seconds (by jumping over your validation code).
 
Share this answer
 
Code Master123 wrote:
depend to much on a file


Guess that would depend what is too much. First, passwords should never, ever, be hard-coded in your application. There are a number of ways to do this. Use Windows authentication, use a database, hash the password initially and compare one that is given.
 
Share this answer
 
Comments
Code Master38 19-Jun-10 1:07am    
Reason for my vote of 1
not a good idea
You could store it in some obscure place in the registry.
 
Share this answer
 
Comments
Code Master38 19-Jun-10 1:07am    
Reason for my vote of 1
a
That will not work because my program is supposed to be portable on your flash drive. HELP!
 
Share this answer
 
v2
You can use your hardware models too as a password and for matching it you can use WMI. Anyhow Hashing and Windows Authentication are good options.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900