Unhashing哈希C#

far*_*ina 1 c# hash winforms

有人可以反转我正在使用的这个方便的哈希码吗?

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);
}
Run Code Online (Sandbox Code Playgroud)

我最终做的一切都失败了:(.

Noo*_*ilk 19

不,你不能反转哈希.典型的过程是将其他输入与您拥有的哈希进行比较,以检查它们是否相同.

喜欢(伪):

initial  = Hash(password);
possible = Hash("test");

if( initial == possible ){
    // we infer that password = "test"
}
Run Code Online (Sandbox Code Playgroud)

但请注意,不应再使用SHA1,SHA0和MD5; (由于各自的不同程度的破坏).你应该使用SHA-2


Mat*_*att 5

“反哈希”的唯一真正方法是使用彩虹表,它是为所有可能的输入计算的哈希值的大表。您查找哈希并得到可能是原始输入的内容。

http://en.wikipedia.org/wiki/Rainbow_table

  • ...这就是为什么在存储敏感数据的哈希值之前对敏感数据进行“加盐”很重要。http://en.wikipedia.org/wiki/Salt_(密码学) (4认同)