A short and clean way of computing MD5 in Java

There are multiple articles (01, 02, 03, 04) talking about how to compute MD5 in Java and some of them have some gotchas regarding the length of the result. Here is a small code snippet that works OOTB:

3 thoughts on “A short and clean way of computing MD5 in Java

    1. Hi Mathew,
      Thanks for your comment. The article you mentioned seems to be focus on a security vulnerability but there are some other uses that MD5 could be applied (e.g. define a bucket for a string). In those cases MD5 is fast and works fine. I agree with you that for security signatures it shouldn’t be taken into consideration.

Leave a Reply

Your email address will not be published. Required fields are marked *