How to convert hash data to original data? [duplicate]

邮差的信 提交于 2021-02-05 12:28:59

问题


Possible Duplicate:
Is it possible to decrypt md5 hashes?

I hashed data with ComputeHash how can I learn original data from hashed data?

private void btn_Hash_Click(object sender, EventArgs e)
{
    HashAlgorithm ha = HashAlgorithm.Create();
    Stream file = new FileStream(@"C:\temp\simetrik.txt", FileMode.Open, FileAccess.Read);
    hashClass.hash = ha.ComputeHash(file);

    listBox1.Items.Add(BitConverter.ToString(hashClass.hash));
}

回答1:


You don't. The whole point of a cryptographic hash is that it's supposed to be computationally infeasible to reverse in general. The best you can do is check known dictionaries and rainbow tables. Neither of these will help much for unique plaintext. Perhaps you should be using an encryption algorithm instead.

Also, you should explicitly specify the algorithm you want. E.g.:

HashAlgorithm.Create("SHA1");



回答2:


You can't convert it back, hashing works only one way. The reason is that (1) it looses data - your hash uses much less memory than the original data. Think about string being hashed to int (2) many hashing algorithms are deliberately constructed in a way to make it computationally impossible to reverse them.




回答3:


The only way is to use a rainbow table, but I'm sure this is not exactly what you want. :)



来源:https://stackoverflow.com/questions/3289087/how-to-convert-hash-data-to-original-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!