有人可以反转我正在使用的这个方便的哈希码吗?
using System.Security.Cryptography;
public static string EncodePasswordToBase64(string password)
{ byte[] bytes = Encoding.Unicode.GetBytes(password);
byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes);
return Convert.ToBase64String(inArray);
}
我最终做的一切都失败了:(。
最佳答案
不,您不能反转散列。典型的过程是将其他输入与您拥有的哈希进行比较,以检查它们是否相同。
喜欢(伪):
initial = Hash(password);
possible = Hash("test");
if( initial == possible ){
// we infer that password = "test"
}
但请注意,不应再使用 SHA1、SHA0 和 MD5; (由于每个破损程度不同)。你应该使用 SHA-2
关于c# - 如何使用 C# 取消散列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1501230/