/* * Helper */ private static String doDigestForByteArray(final byte[] bytes, final String algorithm) { try { MessageDigest md = MessageDigest.getInstance(algorithm); byte[] hash = md.digest(bytes); return HexUtil.toString(hash); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } }