@Override
    public int doFinal(final byte[] out, final int offset) {
      if (bufferPos != 213) {
        throw new IllegalStateException("The buffer must be filled with 213 bytes");
      }

      if (useNative) {
        LibBlake2bf.blake2bf_eip152(out, buffer);
      } else {
        compress();
        for (int i = 0; i < h.length; i++) {
          System.arraycopy(Pack.longToLittleEndian(h[i]), 0, out, i * 8, 8);
        }
      }

      reset();

      return 0;
    }
close the digest, producing the final digest value. The doFinal call leaves the digest reset.

@param out the array the digest is to be copied into.
@param offset the offset into the out array the digest is to start at.
crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/Blake2bfMessageDigest.java