C#中最强大的加密 [英] Most powerful encryption in C#

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

问题描述

我想用C#加密一些字符串,我想知道哪种加密功能最强大,以及如何在代码中使用它.

微软还使用哪种加密方式对auth cookie进行加密?

预先感谢.

解决方案

  var  provider =  System.Security.Cryptography.RSACryptoServiceProvider(); provider.ImportParameters(your_rsa_key);

 var  encryptionBytes = provider.Encrypt(System.Text.Encoding.UTF8.GetBytes(" 你好,世界!"),字符串 cryptedTest = System.Text.Encoding.UTF8.GetString(provider.Decrypt(encryptedBytes, true )) ; 



有关更多信息,请访问MSDN-RSACryptoServiceProvider
在MSDN上 [ .NET Encryption Simplified [
如果您需要在两个人之间安全地传输它们,那么您不妨使用公钥加密功能.
如果要加密它们以保护单个用户的文件内容,请查看DES.
如果您使用的是密码,请不要对它们进行加密,而应使用哈希算法.

而最大的最强大"功能​​则与您选择的算法有关:这是您的代码如何工作,以及相关人员如何使用键...


Hi, I want to encrypt some strings in C#, I want to know which encryption is most powerful and how can I use it inside of my code.

And also what kind of encryption Microsoft uses to encrypt auth cookies?

Thanks in advance.

var provider = new System.Security.Cryptography.RSACryptoServiceProvider(); provider.ImportParameters(your_rsa_key);  

var encryptedBytes = provider.Encrypt(     System.Text.Encoding.UTF8.GetBytes("Hello World!"), true);  

string decryptedTest = System.Text.Encoding.UTF8.GetString(provider.Decrypt(encryptedBytes, true)); 



For more info, visit MSDN - RSACryptoServiceProvider
On MSDN[^]


Look at this article, and the table within as you can see SHA512 is as teh author puts it extreme, but slow in comparison to other algo''s.
.NET Encryption Simplified[^]


As for your second question i think SHA1 is used for auth cookies by default, but you could probably verify that by searching the Docs.


It isn''t a case of "most powerful" it''s a case of "what do you want to do with them?"

If you need to securely transfer them between two people, than you want to look ate the Public Key encryption facilities.
If you want to encrypt them to secure file contents for a single user, then look at DES.
If you are talking passwords, then don''t encrypt them, use a hashing algorithm instead.

And the biggest "most powerful" has bugger-all to do with which algorithm you chose: it''s how your code works, and what the humans involved do with the keys...


这篇关于C#中最强大的加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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