MD5 String constructor?

Hi Jules,

why did you remove the MD5(String) constructor? It breaks my existing code that relies on it. Any possibility to get it back?


Nope, it’s definitely not coming back.

We had another thread about this, because there was a lot of confusion about why that method didn’t produce the same checksum as other libraries, and I explained that there are many, many different ways you could create an MD5 from the same string, depending on the encoding. So to avoid this ambiguity, I thought it best to force people to pass it the data in the format they actually want.

There is a nice helper method for doing a utf-8 checksum though, so maybe just use that?

I’ve read that thread and I understand the confusion. But how do I get the same md5 result for a String with the latest version as I did with the old constructor?

Have a look at what the old code did - it’ll only be a couple of lines to reproduce it, and could very easily be wrapped into your own function.