code: public static byte[] hashTwice(byte[] input1, int offset1, int length1,
                                     byte[] input2, int offset2, int length2) {
          MessageDigest digest = newDigest();
          digest.update(input1, offset1, length1);
          digest.update(input2, offset2, length2);
          return digest.digest(digest.digest());
      }
docs: Calculates the hash of hash on the given byte ranges. This is equivalent to
  concatenating the two ranges and then passing the result to {@link #hashTwice(byte[])}.