public void testHash_hashesCorrectly() throws Exception { byte[] buf = new byte[] {'y', 'a', 'm', 's'}; HashCode expectedHash = Hashing.md5().hashBytes(buf); HashingOutputStream out = new HashingOutputStream(Hashing.md5(), buffer); out.write(buf); assertEquals(expectedHash, out.hash()); }
+ (object.getMd5Hash().equals(calculatedMD5) ? "(MATCHES)" : "(MISMATCHES; data altered in transit)")); int calculatedCrc32c = crc32cHashingOutputStream.hash().asInt(); String calculatedEncodedCrc32c = BaseEncoding.base64().encode( Ints.toByteArray(calculatedCrc32c)); + crc32cHashingOutputStream.hash().asInt() + " " + (object.getCrc32c().equals(calculatedEncodedCrc32c) ? "(MATCHES)" : "(MISMATCHES; data altered in transit)"));
public void testHash_hashesCorrectly() throws Exception { byte[] buf = new byte[] {'y', 'a', 'm', 's'}; HashCode expectedHash = Hashing.md5().hashBytes(buf); HashingOutputStream out = new HashingOutputStream(Hashing.md5(), buffer); out.write(buf); assertEquals(expectedHash, out.hash()); }
hashCodes.put(entry.getKey(), entry.getValue().hash());
hash.set(NFO.HASH_VALUE, hos.hash().toString()); metadata.set(NFO.HAS_HASH, hash); metadata.set(NFO.FILE_SIZE, cos.getCount());