protected byte[] digestJarFile(String hashAlg,InputStream in){
  JarInputStream jin=null;
  try {
    jin=new JarInputStream(in);
    JarEntry je=null;
    MessageDigest md=MessageDigest.getInstance(hashAlg);
    while ((je=jin.getNextJarEntry()) != null) {
      if (!je.isDirectory()) {
        md=Utils.hashing(md,jin);
      }
      jin.closeEntry();
    }
    jin.close();
    return md.digest();
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
catch (  NoSuchAlgorithmException ex) {
    ex.printStackTrace();
  }
 finally {
    if (jin != null) {
      try {
        jin.close();
      }
 catch (      IOException ignored) {
      }
      jin=null;
    }
  }
  return null;
}

protected byte [ ] digestJarFile ( String hashAlg , InputStream in ) { JarInputStream jin = null ; try { jin = new JarInputStream ( in ) ; JarEntry je = null ; MessageDigest md = MessageDigest . getInstance ( hashAlg ) ; while ( ( je = jin . getNextJarEntry ( ) ) != null ) { if ( ! je . isDirectory ( ) ) { md = Utils . hashing ( md , jin ) ; } jin . closeEntry ( ) ; } jin . close ( ) ; return md . digest ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } catch ( NoSuchAlgorithmException ex ) { ex . printStackTrace ( ) ; } finally { if ( jin != null ) { try { jin . close ( ) ; } catch ( IOException ignored ) { } jin = null ; } } return null ; }
this function calculate the hash value of a jar file . this function handles the jar file as a concatenation of the decompressed files it contains .
