Let's say I start with a particular 256 bit value. Call this $v$. I then hash that value, and get another 256 bit value. Call this $\text{SHA256}(v)$. I take this value and get another 256 bit value. Call this $\text{SHA256}^2(v)$. More generally, let's call the result of hashing $v$ repeatedly $n$ times $\text{SHA256}^n(v)$.
Now my question is, how big will $n$ be, such that $\text{SHA256}^n(v) = v$?
It would seem to me, that if it's a giant sort of permutation, $n$ would have to be $2^{256}$, is that correct? Is that provable, or is there any information on this? (Just curiosity, really.)
Another question I had was, do all 256 bit strings have unique SHA256 values, and is there a way to show that? (Or, stated differently, can it be shown that there are no SHA-256 collisions in the language of all "256 bit strings"?)
If you want to get back to a specific starting point $v$ then it will take on average $2^{256}$ iterations.If you simply want to find a cycle, it will take about $2^{128}$ iterations, because of the birthday paradox. – user13741 Mar 25 '15 at 18:29