views:

71

answers:

3

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));
}
+6  A: 

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
A: 

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

InsertNickHere
A rainbow table is not a magical method that can find the preimage of the hash of arbitrary amounts of data.
GregS
A: 

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