PathAssembler's MD5 is not MD5

https://github.com/gradle/gradle/blob/351e5d7988d451bf551410b8e59797c98c3152ff/subprojects/wrapper/src/main/java/org/gradle/wrapper/PathAssembler.java#L55-L58

Three problems in this code:

  • String.getBytes doesn’t use a charset

  • Radix should be 16 (hex) not 32

  • BigInteger shouldn’t be used, it drops leading zeros

Since this is just machine-local caching it’s actually fine that this algorithm isn’t md5, but it shouldn’t advertise itself as such. I’d really prefer if the algorithm was changed to actually be md5, however.

Interested in submitting a PR?

Yep. Forked, implemented, and running the tests now!

Awesome.

Would be good to add a test that verifies our md5 creation actually creates valid md5 hashes. I’d do this by using commons-codec’s DigestUtil’s in a unit test and compare with what our code produces.

We can’t just use commons-codec in the wrapper code because we can’t add the weight.