Comment

Comment by verygoodname

> Having the explicit length is quite superfluous

Not entirely. It makes it so that, to achieve a "full" collision, you have to ensure that the sets of data collide both in SHA hash and in length, helping to prevent attacks that rely on appending/prepending/removing data (for example, "length extension attacks" involve manipulation of the hash by appending data).

TL;DR: It is harder to find a collision SHA(B) for SHA(A) if you add the additional constraint that the length of B must match the length of A.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton