Search code examples
algorithmcomputer-sciencesha256

Create 2 way map for sha256.


Assuming we are looking at the data set of all sha256. Each sha256 value whan aplying the sha256 function on it will result in a different sha256 value. Since our data set is in the same size as the result set we can assume we have a 1 to 1 function.

Is there a way to map all the value and create a backwared function. (Assuming we are looking only on the above data set.

In a reseanable computational time (not 110 years)


Solution

  • Since our data set is in the same size as the result set we can assume we have a 1 to 1 function.

    This is a faulty assumption. There is no reason to believe that SHA256 is a unique mapping across 256-bit inputs; there is, in all probability, at least one (and probably many) pairs of 256-inputs which have the same SHA256 hash.

    Is there a way to map all the value and create a backwared function.

    No. There are 2256 ≈ 1.16×1077 possible SHA256 hashes. As a point of comparison, there are roughly 2.4×1067 atoms in our galaxy. Even if you could turn the entire Milky Way into a computer and write one hash onto each atom, you would run out of atoms long before you finished.