public static MessageDigest hashing(MessageDigest md,InputStream in){
  try {
    DigestInputStream din=new DigestInputStream(in,md);
synchronized (buf) {
      while (din.read(buf) != -1)       ;
    }
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
  return md;
}

public static MessageDigest hashing ( MessageDigest md , InputStream in ) { try { DigestInputStream din = new DigestInputStream ( in , md ) ; synchronized ( buf ) { while ( din . read ( buf ) != - 1 ) ; } } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return md ; }
run the hash with the pass in messagedigest and inputstream
