Everything you need to know about hash length extension attacks (2012)
skullsecurity.org
skullsecurity.org
Note to self: Again, never ever implement your own crypto. Ever.
(I'm actually not sure how to quantify what is and isn't crypto, in a way that's easy for a beginner to understand.)
Well, maybe stating, that RNGs, hash functions (and XOR ;) are just building blocks and tools to build true functionality out of them, would help. I see it quite similar to statistics. Yes I do know and understand mathematical operations, "numbers" and some statistical operations like average, median and maybe even variance but no way I'm capable to setup a proper statistical trial or analysis.
I tend to fall back to: describing what I'd like to achieve with what kind of properties of the result and let ppl really knowledgeable on the topic find the correct keywords, tools and in the end algorithms.
But boy is it tempting to just mash some hash functions together based on some actually quite naive understanding of their properties ;)
Only use a crypto component for the exact purpose that is stated on the tin. Hash function turns lengthy text into a short unique digest. That's the only thing you can use it for. If you try to use it for any other purpose, you will likely screw it up.
For example, git uses SHA-1 digests as unique identifiers for commits. Isn't that extending hash functions from unpredictable digest to identity? What happens when someone finally finds a SHA-1 collision? When Linus made that choice, was he breaking the rule about writing your own crypto?
https://github.com/bwall/HashPump
It's a nice post nevertheless and another reason to use HMAC instead of custom MAC (nota bene: SHA-3 is not vulnerable to this attack).
"Most are vulnerable to length extension attacks. SHA3 (Ketchup) is not vulnerable to length extension attacks, because resistance to length extension was a design criteria for the SHA3 contest."
SHA-3 is not vulnerable because it only uses a subset of the internal state as the output (256 output vs 1600 internal). You can't keep going because you're missing the necessary state.