我如何解码使用HA1CryptoServiceProvider()哈希加密的密码 [英] How can i decode the password which is encrypted by using HA1CryptoServiceProvider() hash

查看:428
本文介绍了我如何解码使用HA1CryptoServiceProvider()哈希加密的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此
密码进行了加密

i have encrypted password by using this

public static string CalculateSHA1(string text)
       {
           string hashed = "";

           SHA1 sha1 = new SHA1CryptoServiceProvider();
           byte[] hash = sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(text));

           foreach (byte b in hash)
               hashed += String.Format("{0,2:X2}", b);

           return hashed;
       }



我如何获得解码后的密码

[edit]忽略HTML ..."选项已禁用-OriginalGriff [/edit]



how can i get the decoded password

[edit]"Ignore HTML..." option disabled - OriginalGriff[/edit]

推荐答案

您不能. SHA不是加密算法,而是哈希算法.区别在于,前者可以使用适当的加密密钥进行反转,而后者完全不能反转.

这里有关于如何处理密码的说明:密码存储:操作方法 [ ^ ]
You can''t. SHA is not an encryption algorithm, it is a hashing algorithm. The difference is that the former can be reversed with the appropriate encryption key, the latter cannot be reversed at all.

There is an explanation of what to do with passwords here: Password Storage: How to do it.[^]


只需考虑一下:谁需要一个可以解密密码的安全方案?它永远不需要进行身份验证,并且是不可能的.您以散列或加密形式存储密码,并且永远不要将密码与存储的密码进行比较.相反,您将密码的哈希或加密形式与存储的哈希或加密形式进行比较.

—SA
Just think a bit: who would need a security schema where a password could be decrypted? It is never needed for authentication and not possible. You store password in hashed or encrypted form and never compare password with stored password. Instead, you compare hashed or encrypted form of password with stored hashed or encrypted form.

—SA


这篇关于我如何解码使用HA1CryptoServiceProvider()哈希加密的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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