public static String hexDigest(String algorithm, File[] files) {
        try {
            MessageDigest md = MessageDigest.getInstance(algorithm);
            byte[] buf = new byte[4096];
            for (File f : files) {
                FileInputStream in = new FileInputStream(f);
                int nread = in.read(buf);
                while (nread > 0) {
                    md.update(buf, 0, nread);
                    nread = in.read(buf);
                }
                in.close();
            }
            return toHex(md.digest(buf));
        } catch (Exception ex) {
            ex.printStackTrace(System.out);
        }
        return "<error>";
    }