|
|
|
|
|
by mistercow
4706 days ago
|
|
>[1] Note that 128-bit hashes are at best 2^64 complexity to break; using a 128-bit hash is irresponsible based on sheer digest length. Can a short hash which has not been weakened be lengthened by taking two hashes and concatenating? fixedSalt = "blah"
longerHash = (salt, input) ->
hash(salt + input) + hash(salt + fixedSalt + input)
Edit: Never mind. Obviously an attacker would only have to break the first half of the resulting hash.But is there any valid way to lengthen a too-short hash? Not that it's of practical importance; I'm just curious academically. |
|
Merkle-Damgard hash functions look like this:
For message M, initial state H, and compression function C. In other words, pad the message, break it into blocks, and use the compression function to "mix" each block into the hash function's state. The final state is the result.Antoine Joux showed that for any MD hash function, generating many collisions is not much more difficult than generating one. Here's how:
Here's the trick: each single-block collision you find is actually doubling your set of colliding messages. This is because for each block of the message, you can select either of two candidate blocks. So if the effort required to find a collision in a b-bit hash function is 2^(b/2), the effort to find 2^n such collisions is only n * 2^(b/2).What does this mean for cascaded hash functions? Well, consider a hypothetical construction that simply concatenates a 128-bit hash function with a 160-bit function. A plan of attack might look like this:
The effort to find a collision under both functions is thus only about what it takes to find a collision under the stronger of the two.Shameless plug: we will have a few problems exploring the consequences of Joux collisions in set seven of the Matasano crypto challenges.