### Question:
MD5Authentication { public static String encode(String username, String password, byte[] salt) { byte[] digest, passDigest; MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } messageDigest.update(password.getBytes(UTF_8)); messageDigest.update(username.getBytes(UTF_8)); digest = messageDigest.digest(); byte[] hexDigest = toHex(digest).getBytes(US_ASCII); messageDigest.update(hexDigest); messageDigest.update(salt); passDigest = messageDigest.digest(); return "md5" + toHex(passDigest); }  static String encode(String username, String password, byte[] salt);  }### Answer:
@Test public void encodeTest() { assertEquals( "md54cd35160716308e3e571bbba12bb7591", MD5Authentication.encode("scott", "tiger", "salt'n'pepper".getBytes(StandardCharsets.UTF_8))); }