Getting curious about SHA-256 cycles (what happens if you hash a value repeatedly), I came across this question:

Cycles in SHA256

The first answer suggests that using a 7-bit hash, it's possible to find a value that hashes to itself. See the red dot which isn't part of a loop but on its own:

7 bit SHA256 hashing

I assume from the diagram, this means if I apply the 7-bit hashing function to this value, the output matches the input. So my question is if such values are possible in SHA-256, and if anyone knows what value(s) hash to themselves or has ever found one of those values.

  • $\begingroup$ Also relevant: crypto.stackexchange.com/q/48580 $\endgroup$ – Squeamish Ossifrage Nov 1 '19 at 17:59
  • $\begingroup$ Short answer to exactly the question you asked: yes, there's a pretty good chance that a SHA-256 fixed point exists, but no, nobody has ever published one and probably never will without also announcing a major breakthrough in cryptanalysis. $\endgroup$ – Squeamish Ossifrage Nov 1 '19 at 18:01
  • $\begingroup$ Thanks for the quick replies guys. I didn't know this was called a "fixed point" and it seems like the answer is available by merging both of those linked questions. Hopefully, my answer makes sense to bring everything together. $\endgroup$ – azoundria Nov 1 '19 at 18:16

This question here gives the probability of such a value, called a "fixed point" existing as 63% (based on assuming a "random" property of SHA256):

Cryptographic hash where the hashing function input is similar to the result

There is at least one such "fixed point" of the compression function that the SHA256 algorithm uses. An example is here:

Fixed point of the SHA-256 compression function

As explained in that answer, "[e]asy to find fixed-points are a known property of this construction", therefore this isn't a problem.

  • 1
    $\begingroup$ The "63%" probability assumes SHA-256 is a "random function"; however SHA-256 is not proven to be random (whatever that means); it may show nonrandom characteristics we don't know about. $\endgroup$ – poncho Nov 1 '19 at 18:14
  • 1
    $\begingroup$ It is not a fixed point of SHA-256 it is a fixed point of the compression function that SHA-256 uses. $\endgroup$ – kelalaka Nov 1 '19 at 18:42
  • $\begingroup$ Thanks for the corrections. Hopefully, it's accurate now. $\endgroup$ – azoundria Nov 1 '19 at 20:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.