public static String generateIdentity(java.io.File documentFile) {
        StringBuffer result = new StringBuffer();
        FileInputStream in = null;
        {
            DigestInputStream md5 = null;
            try {
                in = new FileInputStream(documentFile);
                md5 = new DigestInputStream(in, MessageDigest.getInstance("MD5"));
                byte[] block = new byte[1048576];
                while (md5.read(block, 0, 1048576) != -1) {
                }
                byte[] md5Result = null;
                md5Result = md5.getMessageDigest().digest();
                for (byte b : md5Result) {
                    result.append(String.format("%x", b));
                }
            } catch (FileNotFoundException ex) {
                Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
            } catch (NoSuchAlgorithmException ex) {
                Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
            } finally {
                try {
                    in.close();
                } catch (IOException ex) {
                    Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
                try {
                    md5.close();
                } catch (IOException ex) {
                    Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        return result.toString();
    }