# retrieving an original data from a hash: is it reliable?

Normally, one of the purposes of hashing a string (such as a transaction) is summarizing the data to save the size because of the space limitation.

If this proposition is true, now assume we need to read the original data and so we need to extract the exact original data (with all details).

Now the question is if the extracted data from the hash data is exotically equal to the original data?

And if yes, is there any tool to do this? (for example, for retrivieng the original data from `SHA256` hashing algorithm).

And if we cannot retrieve the original data from a hashed value, how hashed data can help us for validating an original data?

now assume we need to read the original data and so we need to extract the exact original data (with all details).

This is impossible for any good cryptographic hash algorithm.

It's theoretically possible (though by design so improbable it will never happen) to guess some data that will hash to that value, but there's no way to know if it's the original data.

And if we cannot retrieve the original data from a hashed value, how hashed data can help us for validating an original data?

If someone has the original data, they can hash it again and verify that the hash matches the one previously stored.

• note that smarx used the term cryptographic hash algorithm. A hash algorithm has by default only two properties: It maps inputs of arbitrary length to outputs of a defined length and further it should be efficiently calculable. Since the inputs could potentially have any length, including a length bigger then the results defined length, the mapping is not injective and therefore you cannot create the inverse of the hashing function which delivers you the preimage, the original input you want to find. – sea212 Sep 19 '18 at 13:45
• A cryptographic hash algorithm has more constrains. It defines preimage resistance 1: H(x) = y, reconstructing x from y should not be possible. Preimage resistance 2: H(x) = y, finding x2 with H(x2) = y should not be possible. Collisionresistance: You should not be able to choose x1 and x2, so that H(x1) = H(x2) – sea212 Sep 19 '18 at 13:55

As a follow-up to the answer by @smarx:

if your need to pack the data to a relatively compact form and then restore the original data, it is lossless compression you want, not hashing.