用密码保护程序? [英] Protect program with password?
问题描述
:confused:
有没有一种方法可以使用非硬密码保护Windows窗体!并不太依赖文件???我的意思是,如果somone删除了该文件,该程序仍将正常运行.我在这里需要一些代码.
: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.
推荐答案
只需将密码的哈希存储在程序中的某些字符串中,重新哈希用户提供给您的密码,然后将其与存储的哈希进行比较.
请注意,坚定的黑客可能会在几秒钟内(跳过验证代码)将其破解.
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).
在很大程度上取决于文件
depend to much on a file
猜猜这将取决于太多.首先,永远不要在应用程序中对密码进行硬编码.有很多方法可以做到这一点.使用Windows身份验证,使用数据库,首先对密码进行哈希处理,然后比较给出的密码.
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.
您可以将其存储在注册表中一些晦涩的地方.
You could store it in some obscure place in the registry.
这篇关于用密码保护程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!