C#WPF加密 [英] C# WPF Encryption

查看:912
本文介绍了C#WPF加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用C#WPF加密密码。什么是最好的算法(和易于实现)使用?我想要一些关于如何使用它的例子...

解决方案

不要尝试创建自己的加密算法,而是使用.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆