如何使用c#将md5加密hash algorithem转换为解密。 [英] how to convert md5 encryption hash algorithem to decryption using c# .

查看:68
本文介绍了如何使用c#将md5加密hash algorithem转换为解密。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我



Please Help me

MD5 md5 = new MD5CryptoServiceProvider();

           //compute hash from the bytes of text
           md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(sourceString));

           //get hash result after compute it
           byte[] result = md5.Hash;

           StringBuilder strBuilder = new StringBuilder();
           for (int i = 0; i < result.Length; i++)
           {
               //change it into 2 hexadecimal digits
               //for each byte
               strBuilder.Append(result[i].ToString("x2"));
           }

           return strBuilder.ToString();





这是我的加密代码。



已添加代码块[/ Edit]



this is my encryption Code.

Code block added[/Edit]

推荐答案

MD5 [ ^ ]是一种单向哈希算法,没有解密。
MD5[^] is a one-way hash algorithm, there is no decryption.


这是我的加密代码。

不,它不是。散列不是加密。最大的区别是加密是可逆的,散列是不可能的。这意味着,如果您加密某些内容,您可以撤消该过程并使用某种形式的密钥(通常与加密密钥相同,但不一定)解密数据以获取原始输入。你不能用散列算法做到这一点 - 它具有破坏性,它会丢弃数据以获得几乎唯一的排序值,该值代表输入但在任何情况下都不能被反转以产生输入的确切内容。



如果您对数据文件进行哈希处理,则无法将它们解密回原始文件。您需要使用加密算法,例如Triple DES。
"this is my encryption Code."
No, it isn''t. Hashing is not encryption. The big difference is that encryption is reversible, hashing isn''t. That means that if you encrypt something, you can reverse the process and using an key of some form (usually the same as the encryption key, but not necessarily) decrypt the data to get the original input back. You cannot do that with a hashing algorithm - it is destructive, it throws away data to achieve a nearly-unique sort value which represents the input but which cannot under any circumstances be reversed to produce exactly what was input.

If you Hash your data files, you cannot decrypt them back to the original file. You need to use an encryption algorithm such a Triple DES instead.


这篇关于如何使用c#将md5加密hash algorithem转换为解密。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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