public static byte[] hash(byte[] data,int offset,int len){
  try {
    MessageDigest a=MessageDigest.getInstance("SHA-256");
    a.update(data,offset,len);
    return a.digest();
  }
 catch (  NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
  }
}

public static byte [ ] hash ( byte [ ] data , int offset , int len ) { try { MessageDigest a = MessageDigest . getInstance ( "SHA-256" ) ; a . update ( data , offset , len ) ; return a . digest ( ) ; } catch ( NoSuchAlgorithmException e ) { throw new RuntimeException ( e ) ; } }
sha256 hash of arbitrary data
