News for hackers. Stuff that matters.
Re:Show HN: SHA-256 explained step-by-step visually by pbsd on Monday February 07, 2022 @04:13PM (#30251253)
SHA-256 is not a permutation; the expected cycle length is ~2^128. It's how collisions are (generically) found.
Re:Show HN: SHA-256 explained step-by-step visually by colejohnson66 on Monday February 07, 2022 @05:13PM (#30252101)
Pigeonhole principle?
Re:Show HN: SHA-256 explained step-by-step visually by pbsd on Monday February 07, 2022 @05:46PM (#30252484)
Each new output value i can collide with output 1, 2, ..., i-1. So the collision probability of iteration i is (i-1)/2^256. Adding all of the iterations up you have 1/2^256 + 2/2^256 + ... + (i-1)/2^256 = 0.5 i (i-1)/2^256 which approaches 1/2 as you get to 2^128.

In reality you use some variant of Rho which does not store every previous value but uses something like Floyd's cycle detection or distinguished points and requires minimal storage, at the cost of some extra hash computations but still on the order of 2^128.

Re:Show HN: SHA-256 explained step-by-step visually by dragontamer on Monday February 07, 2022 @05:47PM (#30252500)
This situation calls for Birthday paradox, not pigeon hole.