Optimizations to reduce verity verification time

Test: with CPU locked to low freq, verification time of a 400 MB apk is
      reduced from about 2528 ms to 1942 ms, vs 915 ms of the old
      algorithm.  Writing directly into ByteBuffer's backing array saves
      around 100 ms but it does not work for DirectByteBuffer, thus I
      didn't implement this optimization.
Bug: 30972906
Change-Id: I00cf782e18a8351569eaf4593188c1ce6796a634
5 files changed