Will a recursive sha256 run over all 2^256 inputs before a collision?
Short answer: you will &quot;probably&quot; find a collision after 2^128 attempts.
The concept you are looking for is called the birthday problem, explained also very well in this video by Professor Christoph Parr.
One of the approximations from The Birthday Problem is that given a random output space of size n, the probability of an input collision approaches 50% after approximately √n attempts. (2^256)^1/2 = 2^128