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

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

问题描述

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

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 ...

推荐答案

不要试图创建自己的加密算法,通过 System.Security.Cryptography在.NET Framework中提供的加密类

Do not try to create your own encryption algorithm rather use the cryptography classes provided in the .NET Framework through System.Security.Cryptography.

对于密码,一个好的解决方案是使用单向加密,如 MD5 哈希或 SHA1 。当用户输入他/她的密码时,计算散列并将其与存储的散列进行比较。这样做的优点是,您不需要担心如何安全地存储用于加密密码的密钥。

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.

为了提高使用单向哈希的安全性你可以应用一个盐,这帮助限制某些类型的攻击,如字典攻击的有效性等。我没有阅读wiki条目,但我相信将提供更多详细信息。

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天全站免登陆