문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top