@Test public void sha512IsAccurate() throws IOException { byte[] bytes = new byte[100]; final MultiHashingInputStream hashingStream = createAndUseHashingStream(bytes); final HashCode hashCode = hashingStream.hashes().get(HashAlgorithm.SHA512); assertThat(hashCode.toString(), is(equalTo( "f206f4f0ef09b90837f1d15a07c6cf4bd291d817663f9f85a0fc4341ec19910719ad571b6102a366ae848cd0f187d0daef912e05898b82c35213cd49a45ee8e0"))); }
public Map<HashAlgorithm, HashCode> hashes() { Map<HashAlgorithm, HashCode> hashes = new HashMap<>(hashers.size()); for (Entry<HashAlgorithm, Hasher> entry : hashers.entrySet()) { hashes.put(entry.getKey(), entry.getValue().hash()); } return hashes; }
MultiHashingInputStream extends FilterInputStream { public Map<HashAlgorithm, HashCode> hashes() { Map<HashAlgorithm, HashCode> hashes = new HashMap<>(hashers.size()); for (Entry<HashAlgorithm, Hasher> entry : hashers.entrySet()) { hashes.put(entry.getKey(), entry.getValue().hash()); } return hashes; } }
MultiHashingInputStream extends FilterInputStream { public Map<HashAlgorithm, HashCode> hashes() { Map<HashAlgorithm, HashCode> hashes = new HashMap<>(hashers.size()); for (Entry<HashAlgorithm, Hasher> entry : hashers.entrySet()) { hashes.put(entry.getKey(), entry.getValue().hash()); } return hashes; } MultiHashingInputStream(final Iterable<HashAlgorithm> algorithms, final InputStream inputStream); }
MultiHashingInputStream extends FilterInputStream { public Map<HashAlgorithm, HashCode> hashes() { Map<HashAlgorithm, HashCode> hashes = new HashMap<>(hashers.size()); for (Entry<HashAlgorithm, Hasher> entry : hashers.entrySet()) { hashes.put(entry.getKey(), entry.getValue().hash()); } return hashes; } MultiHashingInputStream(final Iterable<HashAlgorithm> algorithms, final InputStream inputStream); @Override int read(); @Override int read(@Nonnull final byte[] bytes, final int off, final int len); @Override boolean markSupported(); @Override void mark(final int readlimit); @Override void reset(); Map<HashAlgorithm, HashCode> hashes(); long count(); }
MultiHashingInputStream extends FilterInputStream { public Map<HashAlgorithm, HashCode> hashes() { Map<HashAlgorithm, HashCode> hashes = new HashMap<>(hashers.size()); for (Entry<HashAlgorithm, Hasher> entry : hashers.entrySet()) { hashes.put(entry.getKey(), entry.getValue().hash()); } return hashes; } MultiHashingInputStream(final Iterable<HashAlgorithm> algorithms, final InputStream inputStream); @Override int read(); @Override int read(@Nonnull final byte[] bytes, final int off, final int len); @Override boolean markSupported(); @Override void mark(final int readlimit); @Override void reset(); Map<HashAlgorithm, HashCode> hashes(); long count();  }