Question

Suppose I have md5(m1) and m2. How can I calculate md5(m1+m2)?

Was it helpful?

Solution

The output of an MD5 digest is simply the concatenation of the 4x 32bit integers that make up its internal state, so it is possible to derive the internal state from the hash. However before the main hashing loop is run, there is an initial pre-processing stage which pads the original message and incorporates the message length, and as a result you can't calculate md5(m1+m2) from md5(m1) and m2.

You should be able to calculate md5(pad(m1)+m2) from md5(m1) and m2. Where pad(m1) is the result of running MD5's pre-processing stage on m1, though that may not be particularly useful.

OTHER TIPS

You... can't. md5 is not a composable function in that sense.

If you are trying to do password salting, then the approach would be md5(md5(m1) + m2).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top