@SuppressWarnings("unchecked")
  @Test
  public void testDigestThreadSafety() throws ExecutionException, InterruptedException {
    final byte[] input = new byte[213];
    ;
    SECURE_RANDOM.nextBytes(input);
    int numberOfHashes = 10;

    CompletableFuture<byte[]>[] futures =
        IntStream.range(0, numberOfHashes)
            .mapToObj(
                i ->
                    CompletableFuture.supplyAsync(
                        () -> {
                          try {
                            MessageDigest clonedDigest = messageDigest.clone();
                            clonedDigest.update(input);
                            byte[] digest = clonedDigest.digest();
                            return digest;
                          } catch (CloneNotSupportedException e) {
                            throw new RuntimeException(e);
                          }
                        }))
            .toArray(CompletableFuture[]::new);

    CompletableFuture.allOf(futures).get();

    byte[] expectedHash = futures[0].get();
    for (CompletableFuture<byte[]> future : futures) {
      assertThat(expectedHash).isEqualTo(future.get());
    }
  }
Test vectors adapted from
https://github.com/keep-network/blake2b/blob/master/compression/f_test.go
crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/Blake2bfMessageDigestTest.java