C#WPF加密 [英] C# WPF Encryption
问题描述
不要尝试创建自己的加密算法,而是使用.NET Framework中提供的加密类,通过 System.Security.Cryptography 。
对于密码,一个很好的解决方案是使用单向加密,如 MD5 哈希或 SHA1 。并且当用户输入他/她的密码时,您计算哈希并将其与存储的哈希进行比较。这样做的好处是,您不必担心如何安全地存储用于加密密码的密钥。
增加使用单向散列的安全性你可以应用盐,这有助于限制某些类型的攻击的有效性,如字典攻击等。我没有阅读wiki条目,但我相信此将提供更多详细信息。
I want to encrypt passwords using the C# WPF. what is the best algorithm (and easy to implement) to use? and I want some example about how to use it ...
Do not try to create your own encryption algorithm rather use the cryptography classes provided in the .NET Framework through System.Security.Cryptography.
For passwords a good solution is to use a oneway encryption like a MD5 hash or SHA1. And when the user enters his/her password you compute the hash and compare it to the stored hash. The advantage of this is that you do not need to worry about how to securely store the key used to encrypt the passwords.
To increase the security of using a one way hash you can apply a salt, this help restrict the effectiveness of certain types of attackes like a dictionary attack etc. I have not read the wiki entry, but I am sure this will provide more detail.
这篇关于C#WPF加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!