Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the security limited to 256-bit? #441

Open
bingmatv opened this issue Jan 7, 2025 · 1 comment
Open

Why is the security limited to 256-bit? #441

bingmatv opened this issue Jan 7, 2025 · 1 comment

Comments

@bingmatv
Copy link

bingmatv commented Jan 7, 2025

The doc says any output longer than 256-bit doesn't provide additional security, why is it limited to the default size?

@oconnor663
Copy link
Member

Most (all?) hash functions that support extended outputs have a similar property. As the hash accepts input, it mixes that input block-by-block into some sort of state. Then at the end, either that state just becomes the output (SHA-2), or it gets mixed up some more to produce one or more output blocks (SHA-3). If an attacker is able to find a collision in the state at any point in that process, then they can can feed in any additional input blocks they like, or produce as many output blocks as they like, and all of that will still be colliding. So the size of the state is an upper bound on how much security the hash can provide. (The security could be lower, though, if the output is truncated for example.)

BLAKE3 is a little different, because the state is actually a tree, but the logic is basically the same. If an attacker can find a collision anywhere in the tree, that lets them produce collisions in the output, so the 256-bit internal tree node hashes (formally "chaining values") are an upper bound on security. (The way 1 KiB chunks are processed also resembles SHA-2.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants