All, While looking into a patch for BasicRealm, I noticed that there are two classes that convert byte[] to a hex-encoded string (e.g. byte[] { 1, 2, a, b ] -> "12ab"): HexUtils and MD5Encoder.
MD5Encoder only has a single method (encode) and it does exactly what HexUtils.toHexString does, except that it only works for exactly 16-byte arrays. I haven't actually written any performance tests, but looking at the code it seems that HexUtils.toHexString would execute slightly faster for a 16-byte array because of repeated integer multiplication in the loop. Is there a reason for MD5Encoder to exist? It appears only to be used in the following classes: RealmBase DigestAuthenticator WebdavServlet Although I suppose a specialty 16-byte-only method might be written to be slightly faster than the general-purpose HexUtils.toHexString method, I'm not sure it's worth having a separate class/method to do it. Any objections to using HexUtils.toHexString uniformly and removing the MD5Encoder class entirely? Thanks, -chris
signature.asc
Description: OpenPGP digital signature