4 ms·
You're essentially using the length as a(n extremely weak) secondary hash in that case. That might be sufficient to disable one known MD5 exploit, but if you're
by sjy 12y ago
You're essentially using the length as a(n extremely weak) secondary hash in that case. That might be sufficient to disable one known MD5 exploit, but if you're worried about vulnerabilities in your primary hash algorithm it would make more sense to use another real hash algorithm for your backup.
- hrjet 12y agoThanks for the answer. I am really not familiar with the mathematics of hash algorithms and I ask just to learn. Why is length essentially a weak hash? Isn't it an additional constraint that works orthogonal to the hash? It serves to restrict the space of collisions and hence directly reduces the exploit surface. Moreover, the length can be independently verified of the hash function, and its space & time complexity is negligible.
- Dylan16807 12y ago> Why is length essentially a weak hash? It's utterly trivial to match by itself. Adding length to a real hash is a mild difficulty increase. Adding a second hash is a massive difficulty increase. > Isn't it an additional constraint that works orthogonal to the hash? Yes. But so is a second hash. > It serves to restrict the space of collisions and hence directly reduces the exploit surface. Very inefficiently. > Moreover, the length can be independently verified of the hash function, and its space & time complexity is negligible. A second hash is independent of the first hash too. Hashing a second time compared to downloading and hashing the first time is pretty close to negligible.