@Test public void testHashGenerationWithoutAddingData() { DataHasher hasher = new DataHasher(HashAlgorithm.SHA2_256); DataHash dataHash = hasher.getHash(); Assert.assertEquals(HashAlgorithm.SHA2_256.getLength(), dataHash.getValue().length); Assert.assertEquals(Base16.encode(dataHash.getValue()), "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"); }
public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; }
DataHasher { public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; } }
DataHasher { public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; } DataHasher(HashAlgorithm algorithm);  DataHasher(HashAlgorithm algorithm, boolean checkExpiration);  DataHasher(); }
DataHasher { public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; } DataHasher(HashAlgorithm algorithm);  DataHasher(HashAlgorithm algorithm, boolean checkExpiration);  DataHasher(); final DataHasher addData(byte[] data, int offset, int length); final DataHasher addData(byte[] data); final DataHasher addData(InputStream inStream); final DataHasher addData(File file); final DataHasher addData(DataHash dataHash); final DataHasher addData(InputStream inStream, int bufferSize); final DataHasher addData(File file, int bufferSize); final DataHash getHash(); final DataHasher reset(); }
DataHasher { public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; } DataHasher(HashAlgorithm algorithm);  DataHasher(HashAlgorithm algorithm, boolean checkExpiration);  DataHasher(); final DataHasher addData(byte[] data, int offset, int length); final DataHasher addData(byte[] data); final DataHasher addData(InputStream inStream); final DataHasher addData(File file); final DataHasher addData(DataHash dataHash); final DataHasher addData(InputStream inStream, int bufferSize); final DataHasher addData(File file, int bufferSize); final DataHash getHash(); final DataHasher reset();  }