-2

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));
}
Community
  • 1
  • 1
Penguen
  • 16,836
  • 42
  • 130
  • 205
  • when you say 'learn original data' do you mean recover from hash, or identify the file that the hash came from? – Simeon Pilgrim Jul 20 '10 at 14:13
  • 1
    Try searching first: http://stackoverflow.com/questions/2760911 http://stackoverflow.com/questions/3153257 http://stackoverflow.com/questions/1240852 http://stackoverflow.com/questions/1471654 http://stackoverflow.com/questions/2717950 http://stackoverflow.com/questions/2235079 http://stackoverflow.com/questions/3153694 http://stackoverflow.com/questions/1161157 http://stackoverflow.com/questions/2298018 http://stackoverflow.com/questions/1501230 – BlueRaja - Danny Pflughoeft Jul 20 '10 at 20:31
  • 1
    But wait: there's more! http://stackoverflow.com/questions/3006710 http://stackoverflow.com/questions/2298018 http://stackoverflow.com/questions/625542 http://stackoverflow.com/questions/1562064 http://stackoverflow.com/questions/173329 http://stackoverflow.com/questions/2600326 http://stackoverflow.com/questions/2486887 http://stackoverflow.com/questions/1653900 http://stackoverflow.com/questions/1263766 http://stackoverflow.com/questions/2524182 – BlueRaja - Danny Pflughoeft Jul 20 '10 at 20:43

3 Answers3

7

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");
Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
1

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.

Grzenio
  • 35,875
  • 47
  • 158
  • 240
0

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

InsertNickHere
  • 3,616
  • 3
  • 26
  • 23